Ejemplo n.º 1
0
        private byte readByte(Reader reader)
        {
            byte c = 0;

            if (decoder.fileState == PARSE_COMPLETE)
            {
                return(c);
            }

            byte b;

            if (decoder.position == decoder.bufferSize)
            {
                b = reader.ReadByte();
                decoder.bufferSize = (int)b;
                if (decoder.bufferSize == 0)
                {
                    decoder.fileState = PARSE_COMPLETE;
                    return(c);
                }
                decoder.buffer = reader.readBytes(decoder.bufferSize);
                b = decoder.buffer[0];
                decoder.position = 1;
            }
            else
            {
                b = decoder.buffer[decoder.position++];
            }
            return(b);
        }
Ejemplo n.º 2
0
 public void read(Reader reader)
 {
     name = reader.ReadString();
     byte[] bytes = reader.readBytes(4);
     value = (bytes[0] << 24) + (bytes[1] << 16) + (bytes[2] << 8) + (bytes[3] << 0);
 }