Class ByteArrayWrapper


  • public class ByteArrayWrapper
    extends Object
    An wrapper class around an byte array, offering various read methods.
    • Field Detail

      • buffer

        protected final byte[] buffer
    • Constructor Detail

      • ByteArrayWrapper

        public ByteArrayWrapper​(byte[] buffer,
                                int offset,
                                int len)
        Constructor for ByteArrayWrapper.
        Parameters:
        buffer - The buffer to be wrapped
        offset - The offset within the buffer
        len - The length of bytes which should be included
    • Method Detail

      • newInstance

        public static ByteArrayWrapper newInstance​(byte[] buffer,
                                                   int offset,
                                                   int len)
      • getPos

        public int getPos()
      • reset

        public void reset()
      • skipTo

        public void skipTo​(int pos)
      • seek

        public void seek​(int pos)
      • hasLeft

        public int hasLeft()
      • readS32

        public int readS32()
        Read an sint32 field value from the stream.
      • readS32Delta

        public int readS32Delta​(int last)
      • readU32

        public int readU32()
        Read a uint32 field value from the stream.
      • readS64

        public long readS64()
        Read an sint64 field value from the stream.
      • readS64Delta

        public long readS64Delta​(long last)
      • readU64

        public long readU64()
        Read a uint64 field value from the stream.
      • readU64Delta

        public long readU64Delta​(long last)
      • readRawByte

        public byte readRawByte()
        Read one byte from the input.
      • readByteArray

        public byte[] readByteArray​(int size)
        Read bytes from input.
        Parameters:
        size - Number of bytes to read.