Class DataInOutStatic

  • All Implemented Interfaces:
    DataIn, DataIO, DataOut

    public class DataInOutStatic
    extends java.lang.Object
    implements DataIO
    • Field Detail

      • data

        public final byte[] data
      • writePos

        public int writePos
      • readPos

        public int readPos
    • Constructor Detail

      • DataInOutStatic

        public DataInOutStatic​(int initSize)
      • DataInOutStatic

        public DataInOutStatic​(byte[] ar)
      • DataInOutStatic

        public DataInOutStatic​(byte[] ar,
                               int readPos,
                               int writePos)
    • Method Detail

      • 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.
      • toString

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

        public byte[] getData()
      • getReadPos

        public int getReadPos()
      • setReadPos

        public void setReadPos​(int readPos)
      • getWritePos

        public int getWritePos()
      • setWritePos

        public void setWritePos​(int writePos)
      • getSizeForWrite

        public int getSizeForWrite()
        Description copied from interface: DataOut
        Returns the size of this output stream for writing, in bytes.
        Specified by:
        getSizeForWrite in interface DataOut
      • isWritable

        public boolean isWritable()
        Description copied from interface: DataOut
        Returns whether this output stream is writable or not.
        Specified by:
        isWritable in interface DataOut
      • clear

        public void clear()
        Description copied from interface: DataOut
        Clears this output stream.
        Specified by:
        clear in interface DataOut
      • 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.
      • 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.
      • 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
      • 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
      • 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
      • 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
      • 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.
      • total

        public int total()