Package org.cakelab.blender.io.util
Class CDataFileRWAccess
- java.lang.Object
-
- org.cakelab.blender.io.util.CDataReadWriteAccess
-
- org.cakelab.blender.io.util.CDataFileRWAccess
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
BigEndianCFileRW
,LittleEndianFileRW
public abstract class CDataFileRWAccess extends CDataReadWriteAccess
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.RandomAccessFile
io
-
Constructor Summary
Constructors Modifier Constructor Description protected
CDataFileRWAccess(java.io.RandomAccessFile in, int pointerSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
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.boolean
readBoolean()
byte
readByte()
void
readFully(byte[] b, int off, int len)
long
skip(long n)
void
writeBoolean(boolean value)
void
writeByte(int value)
void
writeFully(byte[] b, int off, int len)
-
Methods inherited from class org.cakelab.blender.io.util.CDataReadWriteAccess
create, create, getByteOrder, getPointerSize, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFullyInt64, readInt, readInt64, readLong, readShort, writeDouble, writeFloat, writeFully, writeFully, writeFully, writeFully, writeFully, writeFully, writeFullyInt64, writeInt, writeInt64, writeLong, writeShort
-
-
-
-
Method Detail
-
skip
public final long skip(long n) throws java.io.IOException
- Specified by:
skip
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
available
public final int available() throws java.io.IOException
- Specified by:
available
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readFully
public final void readFully(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
readFully
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeFully
public final void writeFully(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
writeFully
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readBoolean
public final boolean readBoolean() throws java.io.IOException
- Overrides:
readBoolean
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeBoolean
public final void writeBoolean(boolean value) throws java.io.IOException
- Overrides:
writeBoolean
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
readByte
public final byte readByte() throws java.io.IOException
- Specified by:
readByte
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
writeByte
public final void writeByte(int value) throws java.io.IOException
- Specified by:
writeByte
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
offset
public final void offset(long offset) throws java.io.IOException
- Specified by:
offset
in classCDataReadWriteAccess
- Throws:
java.io.IOException
-
offset
public long offset() throws java.io.IOException
- Specified by:
offset
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
-
-