public void skipSpacesEtc()
 {
     while (riter.isData() && (riter.getChar() == ' ' || riter.getChar() == '\t' || riter.getChar() == '\r' || riter.getChar() == '\n'))
     {
         riter.inc();
     }
 }
        public static bool AreEqualIgnoreEol(BufferT left, BufferT right)
        {
            if (ReferenceEquals(left, right))
            {
                return(true);
            }
            else if (left == null)
            {
                return(false);
            }
            else if (right == null)
            {
                return(false);
            }

            ReadIteratorT l = left.getReadIterator();
            ReadIteratorT r = right.getReadIterator();

            while (l.isData() && r.isData())
            {
                // \r\n == \n
                if (l.getChar() == '\r' && r.getChar() == '\n')
                {
                    l.inc();
                    if (!l.isData() || l.getChar() != '\n')
                    {
                        return(false);
                    }
                }
                // \n == \r\n
                else if (l.getChar() == '\n' && r.getChar() == '\r')
                {
                    r.inc();
                    if (!r.isData() || r.getChar() != '\n')
                    {
                        return(false);
                    }
                }
                else if (l.getChar() != r.getChar())
                {
                    return(false);
                }

                l.inc();
                r.inc();
            }

            return(!l.isData() && !r.isData());
        }
        public void parseString(out string s)
        {
            StringBuilder sb = new StringBuilder();

            while (riter.isData() && riter.getChar() != '\0')
            {
                sb.Append(riter.getChar());
                riter.inc();
            }
            if (!riter.isData())
            {
                throw new Exception();                 // TODO
            }
            riter.inc();

            s = sb.ToString();
        }
 public void append(ReadIteratorT it, int size)
 {
     while (size > 0 && it.isData())
     {
         int    avail  = it.directlyAvailableSize();
         int    toRead = Math.Min(size, avail);
         byte[] sp     = it.read(toRead);
         append(sp);
         size -= sp.Length;
     }
 }
        public static UInt64 readVlqIntegral(ReadIteratorT riter)
        {
            UInt64 result = 0;
            bool   done   = false;

            while (!done && riter.isData())
            {
                byte current = riter.get();
                riter.inc();
                done = current < 128;
                UInt64 promoted = (UInt64)current & 0x7f;
                result <<= 7;
                result   = result | promoted;
            }
            return(result);
        }