|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.processmining.framework.log.rfb.io.StorageBlock
public class StorageBlock
This class represents a block of bytes, as provided by a block data storage. These blocks can be used to constitute and back a virtual file.
Field Summary | |
---|---|
protected int |
blockNumber
The logical index of this block in the encompassing block data storage. |
protected int |
maxSize
The current maximal number of bytes which can be allocated in this block. |
protected BlockDataStorage |
parent
The block data storage of which this block is a part. |
protected int |
pointer
Current offset of bytes in this block, from which the next read or write operation will occur. |
protected int |
size
The current number of bytes allocated in this block at the moment. |
Constructor Summary | |
---|---|
StorageBlock(BlockDataStorage aParent,
int aBlockNumber,
int aMaxSize)
Creates and initializes a new storage block object. |
Method Summary | |
---|---|
protected void |
adjustSize()
Internal method for automatically growing the current size of this block with each write operation. |
void |
close()
Closes the data storage container. |
RandomAccessStorage |
copy()
Creates a clone, or copy, of this storage, having the exact same contents and the file pointer reset to zero. |
double |
fillRatio()
Returns the fill ratio of this block. |
int |
getBlockNumber()
Returns the logical index of this block in its providing block data storage. |
long |
getFilePointer()
Returns the current file pointer of the storage container. |
int |
getFreeBytes()
Returns the free number of bytes, i.e. |
int |
getMaxSize()
Returns the maximal number of bytes that can be allocated by and from this block. |
long |
length()
Returns the length, or size, in number of bytes currently used by this instance. |
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
|
double |
readDouble()
|
float |
readFloat()
|
void |
readFully(byte[] arg0)
|
void |
readFully(byte[] arg0,
int arg1,
int arg2)
|
int |
readInt()
|
java.lang.String |
readLine()
|
long |
readLong()
|
short |
readShort()
|
int |
readUnsignedByte()
|
int |
readUnsignedShort()
|
java.lang.String |
readUTF()
|
void |
seek(long pos)
Repositions the offset, or file pointer, at which the next read or write operation will occur. |
void |
setBlockNumber(int aBlockNumber)
Sets a new logical index of this bock in its providing block data storage. Warning: Do not use this method unless you know what you are doing! The internal functionality of a storage block depends on its alignment with the encompassing block data storage. |
void |
setMaxSize(int aMaxSize)
Adjusts the maximal allocated number of bytes in this block, used by the encompassing block data storage. |
int |
skipBytes(int n)
Moves the offset, or file pointer, a specified number of bytes towards the end of the storage container. |
void |
write(byte[] arg0)
|
void |
write(byte[] arg0,
int arg1,
int arg2)
|
void |
write(int arg0)
|
void |
writeBoolean(boolean arg0)
|
void |
writeByte(int arg0)
|
void |
writeBytes(java.lang.String arg0)
|
void |
writeChar(int arg0)
|
void |
writeChars(java.lang.String arg0)
|
void |
writeDouble(double arg0)
|
void |
writeFloat(float arg0)
|
void |
writeInt(int arg0)
|
void |
writeLong(long arg0)
|
void |
writeShort(int arg0)
|
void |
writeUTF(java.lang.String arg0)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected BlockDataStorage parent
protected int blockNumber
protected int maxSize
protected int size
protected int pointer
Constructor Detail |
---|
public StorageBlock(BlockDataStorage aParent, int aBlockNumber, int aMaxSize)
aParent
- Block data storage of which this block is a part.aBlockNumber
- Index of this block in the encompassing storage.aMaxSize
- Maximal number of bytes contained in this block.Method Detail |
---|
protected void adjustSize()
public void setMaxSize(int aMaxSize)
aMaxSize
- Maximal size in bytes to be available.public int getMaxSize()
public int getFreeBytes()
public double fillRatio()
[0.0, 1.0]
public int getBlockNumber()
public void setBlockNumber(int aBlockNumber)
aBlockNumber
- The new logical index of this bock
in its providing block data storage.public void close() throws java.io.IOException
RandomAccessStorage
close
in interface RandomAccessStorage
java.io.IOException
public long getFilePointer() throws java.io.IOException
RandomAccessStorage
getFilePointer
in interface RandomAccessStorage
java.io.IOException
public long length() throws java.io.IOException
RandomAccessStorage
length
in interface RandomAccessStorage
java.io.IOException
public void seek(long pos) throws java.io.IOException
RandomAccessStorage
seek
in interface RandomAccessStorage
pos
- The offset in bytes, at which the next operation
will occur.
java.io.IOException
public int skipBytes(int n) throws java.io.IOException
RandomAccessStorage
skipBytes
in interface java.io.DataInput
skipBytes
in interface RandomAccessStorage
java.io.IOException
public void write(int arg0) throws java.io.IOException
write
in interface java.io.DataOutput
java.io.IOException
public void write(byte[] arg0) throws java.io.IOException
write
in interface java.io.DataOutput
java.io.IOException
public void write(byte[] arg0, int arg1, int arg2) throws java.io.IOException
write
in interface java.io.DataOutput
java.io.IOException
public void writeBoolean(boolean arg0) throws java.io.IOException
writeBoolean
in interface java.io.DataOutput
java.io.IOException
public void writeByte(int arg0) throws java.io.IOException
writeByte
in interface java.io.DataOutput
java.io.IOException
public void writeBytes(java.lang.String arg0) throws java.io.IOException
writeBytes
in interface java.io.DataOutput
java.io.IOException
public void writeChar(int arg0) throws java.io.IOException
writeChar
in interface java.io.DataOutput
java.io.IOException
public void writeChars(java.lang.String arg0) throws java.io.IOException
writeChars
in interface java.io.DataOutput
java.io.IOException
public void writeDouble(double arg0) throws java.io.IOException
writeDouble
in interface java.io.DataOutput
java.io.IOException
public void writeFloat(float arg0) throws java.io.IOException
writeFloat
in interface java.io.DataOutput
java.io.IOException
public void writeInt(int arg0) throws java.io.IOException
writeInt
in interface java.io.DataOutput
java.io.IOException
public void writeLong(long arg0) throws java.io.IOException
writeLong
in interface java.io.DataOutput
java.io.IOException
public void writeShort(int arg0) throws java.io.IOException
writeShort
in interface java.io.DataOutput
java.io.IOException
public void writeUTF(java.lang.String arg0) throws java.io.IOException
writeUTF
in interface java.io.DataOutput
java.io.IOException
public boolean readBoolean() throws java.io.IOException
readBoolean
in interface java.io.DataInput
java.io.IOException
public byte readByte() throws java.io.IOException
readByte
in interface java.io.DataInput
java.io.IOException
public char readChar() throws java.io.IOException
readChar
in interface java.io.DataInput
java.io.IOException
public double readDouble() throws java.io.IOException
readDouble
in interface java.io.DataInput
java.io.IOException
public float readFloat() throws java.io.IOException
readFloat
in interface java.io.DataInput
java.io.IOException
public void readFully(byte[] arg0) throws java.io.IOException
readFully
in interface java.io.DataInput
java.io.IOException
public void readFully(byte[] arg0, int arg1, int arg2) throws java.io.IOException
readFully
in interface java.io.DataInput
java.io.IOException
public int readInt() throws java.io.IOException
readInt
in interface java.io.DataInput
java.io.IOException
public java.lang.String readLine() throws java.io.IOException
readLine
in interface java.io.DataInput
java.io.IOException
public long readLong() throws java.io.IOException
readLong
in interface java.io.DataInput
java.io.IOException
public short readShort() throws java.io.IOException
readShort
in interface java.io.DataInput
java.io.IOException
public java.lang.String readUTF() throws java.io.IOException
readUTF
in interface java.io.DataInput
java.io.IOException
public int readUnsignedByte() throws java.io.IOException
readUnsignedByte
in interface java.io.DataInput
java.io.IOException
public int readUnsignedShort() throws java.io.IOException
readUnsignedShort
in interface java.io.DataInput
java.io.IOException
public RandomAccessStorage copy() throws java.io.IOException
RandomAccessStorage
copy
in interface RandomAccessStorage
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |