Exemple #1
0
        public void Decode_Complete()
        {
            var buffer = new Buffer <Byte>(Encoding.UTF8.GetBytes("a\n"));

            Assert.AreEqual(0, buffer.Start);
            Assert.AreEqual(2, buffer.Used);

            Assert.IsFalse(null == CSVDecoder.Decode(buffer));
            Assert.AreEqual(2, buffer.Start);
            Assert.AreEqual(0, buffer.Used);

            Assert.IsTrue(null == CSVDecoder.Decode(buffer));
            Assert.AreEqual(2, buffer.Start);
            Assert.AreEqual(0, buffer.Used);
        }
Exemple #2
0
        public String[][] DecodeAllSymbolSets(String value)
        {
            // Create buffer
            var buffer = new Buffer <Byte>(Encoding.UTF8.GetBytes(value));

            // Call decode until nothing more is returned
            var             symbolSets = new List <String[]>();
            Buffer <String> symbols;

            while (null != (symbols = CSVDecoder.Decode(buffer)))
            {
                symbolSets.Add(symbols.ToArray());
            }

            // Return as array
            return(symbolSets.ToArray());
        }