Package io.aether.utils.dataio
Class ByteBufferDataIO
- java.lang.Object
-
- io.aether.utils.dataio.ByteBufferDataIO
-
-
Constructor Summary
Constructors Constructor Description ByteBufferDataIO(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears this output stream.intgetSizeForRead()Returns the size of the data that can be read from this input stream, in bytes.intgetSizeForWrite()Returns the size of this output stream for writing, in bytes.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.booleanisEmpty()Returns true if this input stream is empty, false otherwise.booleanisWritable()Returns whether this output stream is writable or not.intread(byte[] b, int offset, int len)Reads a byte array from this input stream and returns the number of bytes actually read.booleanreadBoolean()Reads a byte from this input stream and returns it as an integer.doublereadDouble()Returns the next double value from this input stream, casting it to a double value in the range -1.7976931348623157E+308D to 1.7976931348623157E+308D.floatreadFloat()Returns the next float value from this input stream, casting it to a float value in the range -3.4028235E+38F to 3.4028235E+38F.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.shortreadShort()Returns the next short value from this input stream, casting it to a short value in the range -32768 to 32767.DataIOreadSubData(int length)Reads a subarray of bytes from this input stream and returns the number of bytes actually read.intreadUByte()Returns the next byte of data from this input stream, casting it to an unsigned byte value in the range 0-255.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.voidwrite(byte[] b)Writes a byte array to this output stream and returns the number of bytes actually written.intwrite(byte[] 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.voidwrite(DataInOut data)Writes a data input stream to this output stream.voidwrite(DataInOutStatic data)Writes a static data input stream to this output stream.voidwriteBoolean(boolean v)Writes a boolean value to this output stream.voidwriteByte(int b)Writes a byte value to this output stream.voidwriteDouble(double v)Writes a double value to this output stream.voidwriteFloat(float v)Writes a float value to this output stream.voidwriteHexBytes(java.lang.String hex)Writes a string to this output stream as hexadecimal bytes.voidwriteInt(int v)Writes an integer value to this output stream.voidwriteLong(long v)Writes a long value to this output stream.voidwriteShort(int v)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.aether.utils.dataio.DataIn
isReadable, read, read, read, readByte, readBytes, readChar, readString1, readUInt, readUShort
-
Methods inherited from interface io.aether.utils.dataio.DataOut
write, write, writeChar, writeShort
-
-
-
-
Method Detail
-
getSizeForWrite
public int getSizeForWrite()
Description copied from interface:DataOutReturns the size of this output stream for writing, in bytes.- Specified by:
getSizeForWritein interfaceDataOut
-
isWritable
public boolean isWritable()
Description copied from interface:DataOutReturns whether this output stream is writable or not.- Specified by:
isWritablein interfaceDataOut
-
clear
public void clear()
Description copied from interface:DataOutClears this output stream.
-
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.
-
write
public void write(byte[] 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[] 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.
-
writeShort
public void writeShort(int v)
- Specified by:
writeShortin interfaceDataOut
-
readShort
public short readShort()
Description copied from interface:DataInReturns the next short value from this input stream, casting it to a short value in the range -32768 to 32767.
-
writeInt
public void writeInt(int v)
Description copied from interface:DataOutWrites an integer value to 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.
-
writeLong
public void writeLong(long v)
Description copied from interface:DataOutWrites a long value to this output stream.
-
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.
-
writeFloat
public void writeFloat(float v)
Description copied from interface:DataOutWrites a float value to this output stream.- Specified by:
writeFloatin interfaceDataOut- Parameters:
v- The float value to write.
-
readFloat
public float readFloat()
Description copied from interface:DataInReturns the next float value from this input stream, casting it to a float value in the range -3.4028235E+38F to 3.4028235E+38F.
-
writeDouble
public void writeDouble(double v)
Description copied from interface:DataOutWrites a double value to this output stream.- Specified by:
writeDoublein interfaceDataOut- Parameters:
v- The double value to write.
-
readDouble
public double readDouble()
Description copied from interface:DataInReturns the next double value from this input stream, casting it to a double value in the range -1.7976931348623157E+308D to 1.7976931348623157E+308D.- Specified by:
readDoublein interfaceDataIn
-
writeBoolean
public void writeBoolean(boolean v)
Description copied from interface:DataOutWrites a boolean value to this output stream.- Specified by:
writeBooleanin interfaceDataOut- Parameters:
v- The boolean value to write.
-
readBoolean
public boolean readBoolean()
Description copied from interface:DataInReads a byte from this input stream and returns it as an integer.- Specified by:
readBooleanin interfaceDataIn
-
toArray
public byte[] toArray()
Description copied from interface:DataInReturns a copy of this input stream as an array of bytes.
-
skipBytes
public void skipBytes(int n)
Description copied from interface:DataInSkips the specified number of bytes in this input stream.
-
isEmpty
public boolean isEmpty()
Description copied from interface:DataInReturns true if this input stream is empty, false otherwise.
-
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.
-
readSubData
public DataIO readSubData(int length)
Description copied from interface:DataInReads a subarray of bytes from this input stream and returns the number of bytes actually read.- Specified by:
readSubDatain interfaceDataIn- Parameters:
length- The maximum number of bytes to read.
-
writeHexBytes
public void writeHexBytes(java.lang.String hex)
Description copied from interface:DataOutWrites a string to this output stream as hexadecimal bytes.- Specified by:
writeHexBytesin interfaceDataOut- Parameters:
hex- The string to write as hexadecimal bytes.
-
write
public void write(DataInOut data)
Description copied from interface:DataOutWrites a data input stream to this output stream.
-
write
public void write(DataInOutStatic data)
Description copied from interface:DataOutWrites a static data input stream to this output stream.
-
write
public void write(DataIn data)
Description copied from interface:DataOutWrites a data input stream to this output stream.
-
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.
-
-