Package org.cakelab.blender.io.util
Class CBufferReadWrite
- java.lang.Object
-
- org.cakelab.blender.io.util.CDataReadWriteAccess
-
- org.cakelab.blender.io.util.CBufferReadWrite
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class CBufferReadWrite extends CDataReadWriteAccess
-
-
Constructor Summary
Constructors Constructor Description CBufferReadWrite(java.nio.ByteBuffer rawData, long address, int pointerSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
java.nio.ByteOrder
getByteOrder()
byte[]
getBytes()
provides access to the native data buffer.long
offset()
void
offset(long offset)
void
padding(int alignment)
Same asCDataReadWriteAccess.padding(int, boolean)
with 'extend == false'.void
padding(int alignment, boolean extend)
Inserts padding at a given offset to fit a given alignment during reading or writing in streams.byte
readByte()
double
readDouble()
float
readFloat()
void
readFully(byte[] b, int off, int len)
int
readInt()
long
readInt64()
short
readShort()
long
skip(long n)
void
writeByte(int value)
void
writeDouble(double value)
void
writeFloat(float value)
void
writeInt(int value)
void
writeInt64(long value)
void
writeShort(short value)
-
Methods inherited from class org.cakelab.blender.io.util.CDataReadWriteAccess
create, create, getPointerSize, readBoolean, readFully, readFully, readFully, readFully, readFully, readFully, readFullyInt64, readLong, writeBoolean, writeFully, writeFully, writeFully, writeFully, writeFully, writeFully, writeFully, writeFullyInt64, writeLong
-
-
-
-
Method Detail
-
readShort
public short readShort() throws java.io.IOException
- Specified by:
readShort
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readInt
public int readInt() throws java.io.IOException
- Specified by:
readInt
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readInt64
public long readInt64() throws java.io.IOException
- Specified by:
readInt64
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readFloat
public float readFloat() throws java.io.IOException
- Specified by:
readFloat
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readDouble
public double readDouble() throws java.io.IOException
- Specified by:
readDouble
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
offset
public long offset() throws java.io.IOException
- Specified by:
offset
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
offset
public void offset(long offset) throws java.io.IOException
- Specified by:
offset
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Specified by:
skip
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Specified by:
available
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
padding
public void padding(int alignment) throws java.io.IOException
Description copied from class:CDataReadWriteAccess
Same asCDataReadWriteAccess.padding(int, boolean)
with 'extend == false'.- Specified by:
padding
in classCDataReadWriteAccess
- Parameters:
alignment
- Requrested aligment- Throws:
java.io.IOException
-
padding
public void padding(int alignment, boolean extend) throws java.io.IOException
Description copied from class:CDataReadWriteAccess
Inserts padding at a given offset to fit a given alignment during reading or writing in streams. In case of writing, the stream can't just skip past the end and needs to actually write. The parameter 'extend' tells this method whether it is allowed to extend past the end or not.- Specified by:
padding
in classCDataReadWriteAccess
- Parameters:
alignment
- Requrested aligmentextend
- Extend past boundary (write mode)- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
readByte
public byte readByte() throws java.io.IOException
- Specified by:
readByte
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
readFully
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeByte
public void writeByte(int value) throws java.io.IOException
- Specified by:
writeByte
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeShort
public void writeShort(short value) throws java.io.IOException
- Specified by:
writeShort
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeInt
public void writeInt(int value) throws java.io.IOException
- Specified by:
writeInt
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeInt64
public void writeInt64(long value) throws java.io.IOException
- Specified by:
writeInt64
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float value) throws java.io.IOException
- Specified by:
writeFloat
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double value) throws java.io.IOException
- Specified by:
writeDouble
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
getByteOrder
public java.nio.ByteOrder getByteOrder()
- Specified by:
getByteOrder
in classCDataReadWriteAccess
-
getBytes
public byte[] getBytes()
provides access to the native data buffer. This is supposed to be used by internal methods only, which know how to handle the data.
-
-