Class NetworkData


  • public class NetworkData
    extends Object
    • Constructor Detail

      • NetworkData

        public NetworkData​(int size)
      • NetworkData

        public NetworkData()
      • NetworkData

        public NetworkData​(byte[] data)
      • NetworkData

        public NetworkData​(byte[] data,
                           int offset,
                           int length)
        Allow for data buffer with additional data. Data before position marked by offset and after position marked by length will be ignored.
        Parameters:
        data -
        offset -
        length -
    • Method Detail

      • update

        public NetworkData update​(byte[] data,
                                  int offset,
                                  int length)
      • length

        public int length()
      • bytesAvailable

        public int bytesAvailable()
      • isBytesAvailable

        public boolean isBytesAvailable()
      • readUnsignedInt

        public long readUnsignedInt()
      • readUnsignedByte

        public short readUnsignedByte()
      • readUnsignedChar

        public char readUnsignedChar()
      • readBytes

        public byte[] readBytes()
      • readBytes

        public void readBytes​(byte[] destination)
      • readBytes

        public byte[] readBytes​(int len,
                                int max)
        Read limited number of bytes into result (max param), but always return result with size of len param. addional bytes are zero.
        Parameters:
        len - the size of return byte[]
        max - the max number of bytes read from buffer
        Returns:
        fixed sized array
      • readBytes

        public void readBytes​(byte[] dst,
                              int pos,
                              int len)
      • writeChar

        public void writeChar​(int c)
      • writeByte

        public void writeByte​(int b)
      • writeBytes

        public void writeBytes​(byte[] b)
      • writeInt

        public void writeInt​(long i)
      • write

        public byte[] write()
      • getReaderIndex

        public int getReaderIndex()
      • setReaderIndex

        public void setReaderIndex​(int index)
      • setReaderIndex

        public void setReaderIndex​(int index,
                                   boolean abs)
      • getWriterIndex

        public int getWriterIndex()
      • markReaderIndex

        public void markReaderIndex()
      • resetReaderIndex

        public void resetReaderIndex()
      • rewind

        public void rewind​(int bytes)
      • getStringDecodeBuffer

        public byte[] getStringDecodeBuffer()