Package io.aether.utils.dataio
Class DataInOut
- java.lang.Object
-
- io.aether.utils.dataio.DataInOut
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckSize(int size)voidclear()Clears this output stream.byte[]getData()intgetReadPos()intgetSizeForRead()Returns the size of the data that can be read from this input stream, in bytes.intgetWritePos()intindexOf(int limit, byte val)Returns the index within this input stream of the first occurrence of the specified byte, or -1 if no such byte exists.intread(byte[] b, int offset, int len)Reads a byte array from this input stream and returns the number of bytes actually read.intreadInt()Returns the next int value from this input stream, casting it to an int value in the range -2147483648 to 2147483647.longreadLong()Returns the next long value from this input stream, casting it to a long value in the range -9223372036854775808 to 9223372036854775807.intreadUByte()Returns the next byte of data from this input stream, casting it to an unsigned byte value in the range 0-255.intreadUShort()Returns the next unsigned short value from this input stream, casting it to an int value in the range 0-65535.voidsetData(byte[] data)voidsetReadPos(int readPos)voidsetWritePos(int writePos)voidskipAllBytes()Skips all bytes in this input stream.voidskipBytes(int n)Skips the specified number of bytes in this input stream.byte[]toArray()Returns a copy of this input stream as an array of bytes.byte[]toArrayCopy()java.lang.StringtoString()voidtrim()voidwrite(byte @NotNull [] b)Writes a byte array to this output stream and returns the number of bytes actually written.intwrite(byte @NotNull [] b, int off, int len)Writes a byte array to this output stream and returns the number of bytes actually written.voidwrite(DataIn data)Writes a data input stream to this output stream.voidwriteByte(int v)Writes a byte value to this output stream.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.aether.utils.dataio.DataIn
isEmpty, isReadable, read, read, read, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readShort, readString1, readSubData, readUInt
-
Methods inherited from interface io.aether.utils.dataio.DataOut
getSizeForWrite, isWritable, write, write, write, write, writeBoolean, writeChar, writeDouble, writeFloat, writeHexBytes, writeInt, writeLong, writeShort, writeShort
-
-
-
-
Method Detail
-
toArray
public byte[] toArray()
Description copied from interface:DataInReturns a copy of this input stream as an array of bytes.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
write
public void write(DataIn data)
Description copied from interface:DataOutWrites a data input stream to this output stream.
-
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:DataOutClears this output stream.
-
readInt
public int readInt()
Description copied from interface:DataInReturns the next int value from this input stream, casting it to an int value in the range -2147483648 to 2147483647.
-
readLong
public long readLong()
Description copied from interface:DataInReturns the next long value from this input stream, casting it to a long value in the range -9223372036854775808 to 9223372036854775807.
-
readUShort
public int readUShort()
Description copied from interface:DataInReturns the next unsigned short value from this input stream, casting it to an int value in the range 0-65535.- Specified by:
readUShortin interfaceDataIn
-
toArrayCopy
public byte[] toArrayCopy()
-
getSizeForRead
public int getSizeForRead()
Description copied from interface:DataInReturns the size of the data that can be read from this input stream, in bytes.- Specified by:
getSizeForReadin interfaceDataIn
-
read
public int read(byte[] b, int offset, int len)Description copied from interface:DataInReads a byte array from this input stream and returns the number of bytes actually read.
-
trim
public void trim()
-
skipAllBytes
public void skipAllBytes()
Description copied from interface:DataInSkips all bytes in this input stream.- Specified by:
skipAllBytesin interfaceDataIn
-
indexOf
public int indexOf(int limit, byte val)Description copied from interface:DataInReturns the index within this input stream of the first occurrence of the specified byte, or -1 if no such byte exists.
-
skipBytes
public void skipBytes(int n)
Description copied from interface:DataInSkips the specified number of bytes in this input stream.
-
write
public void write(byte @NotNull [] b)
Description copied from interface:DataOutWrites a byte array to this output stream and returns the number of bytes actually written.
-
write
public int write(byte @NotNull [] b, int off, int len)Description copied from interface:DataOutWrites a byte array to this output stream and returns the number of bytes actually written.
-
readUByte
public int readUByte()
Description copied from interface:DataInReturns the next byte of data from this input stream, casting it to an unsigned byte value in the range 0-255.
-
writeByte
public void writeByte(int v)
Description copied from interface:DataOutWrites a byte value to this output stream.
-
checkSize
public void checkSize(int size)
-
-