Class DataInOut

    • Field Detail

      • data

        public byte[] data
      • writePos

        public int writePos
      • readPos

        public int readPos
    • Constructor Detail

      • DataInOut

        public DataInOut​(byte[] data,
                         int len)
      • DataInOut

        public DataInOut()
      • DataInOut

        public DataInOut​(int initSize)
      • DataInOut

        public DataInOut​(byte[] data)
    • Method Detail

      • toArray

        public byte[] toArray()
        Description copied from interface: DataIn
        Returns a copy of this input stream as an array of bytes.
        Specified by:
        toArray in interface DataIn
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • write

        public void write​(DataIn data)
        Description copied from interface: DataOut
        Writes a data input stream to this output stream.
        Specified by:
        write in interface DataOut
        Parameters:
        data - The data input stream to write.
      • getData

        public byte[] getData()
      • setData

        public void setData​(byte[] data)
      • getWritePos

        public int getWritePos()
      • setWritePos

        public void setWritePos​(int writePos)
      • getReadPos

        public int getReadPos()
      • setReadPos

        public void setReadPos​(int readPos)
      • clear

        public void clear()
        Description copied from interface: DataOut
        Clears this output stream.
        Specified by:
        clear in interface DataOut
      • readInt

        public int readInt()
        Description copied from interface: DataIn
        Returns the next int value from this input stream, casting it to an int value in the range -2147483648 to 2147483647.
        Specified by:
        readInt in interface DataIn
      • readLong

        public long readLong()
        Description copied from interface: DataIn
        Returns the next long value from this input stream, casting it to a long value in the range -9223372036854775808 to 9223372036854775807.
        Specified by:
        readLong in interface DataIn
      • readUShort

        public int readUShort()
        Description copied from interface: DataIn
        Returns the next unsigned short value from this input stream, casting it to an int value in the range 0-65535.
        Specified by:
        readUShort in interface DataIn
      • toArrayCopy

        public byte[] toArrayCopy()
      • getSizeForRead

        public int getSizeForRead()
        Description copied from interface: DataIn
        Returns the size of the data that can be read from this input stream, in bytes.
        Specified by:
        getSizeForRead in interface DataIn
      • read

        public int read​(byte[] b,
                        int offset,
                        int len)
        Description copied from interface: DataIn
        Reads a byte array from this input stream and returns the number of bytes actually read.
        Specified by:
        read in interface DataIn
        Parameters:
        b - The byte array to read into.
        offset - The starting position in the array to write to.
        len - The maximum number of bytes to read.
        Returns:
        The number of bytes actually read.
      • trim

        public void trim()
      • skipAllBytes

        public void skipAllBytes()
        Description copied from interface: DataIn
        Skips all bytes in this input stream.
        Specified by:
        skipAllBytes in interface DataIn
      • indexOf

        public int indexOf​(int limit,
                           byte val)
        Description copied from interface: DataIn
        Returns the index within this input stream of the first occurrence of the specified byte, or -1 if no such byte exists.
        Specified by:
        indexOf in interface DataIn
      • skipBytes

        public void skipBytes​(int n)
        Description copied from interface: DataIn
        Skips the specified number of bytes in this input stream.
        Specified by:
        skipBytes in interface DataIn
        Parameters:
        n - The number of bytes to skip.
      • write

        public void write​(byte @NotNull [] b)
        Description copied from interface: DataOut
        Writes a byte array to this output stream and returns the number of bytes actually written.
        Specified by:
        write in interface DataOut
        Parameters:
        b - The byte array to write from.
      • write

        public int write​(byte @NotNull [] b,
                         int off,
                         int len)
        Description copied from interface: DataOut
        Writes a byte array to this output stream and returns the number of bytes actually written.
        Specified by:
        write in interface DataOut
        Parameters:
        b - The byte array to write from.
        off - The starting position in the array to read from.
        len - The maximum number of bytes to write.
      • readUByte

        public int readUByte()
        Description copied from interface: DataIn
        Returns the next byte of data from this input stream, casting it to an unsigned byte value in the range 0-255.
        Specified by:
        readUByte in interface DataIn
      • writeByte

        public void writeByte​(int v)
        Description copied from interface: DataOut
        Writes a byte value to this output stream.
        Specified by:
        writeByte in interface DataOut
        Parameters:
        v - The byte value to write.
      • checkSize

        public void checkSize​(int size)