|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.processmining.framework.log.rfb.io.ATERandomFileBuffer
public class ATERandomFileBuffer
This class provides a random-access interface to a sequential set of audit trail entries. These audit trail entries are buffered not in heap space, but in a binary buffer file, whose encoding is implemented in this class as well.
The structure of a buffer file is a sequence of binary records, one for each audit trail entry, where records are encoded as follows:
Nested Class Summary | |
---|---|
protected class |
ATERandomFileBuffer.ATERandomFileBufferIterator
This class implements a lightweight iterator on a file-buffered random access collection of audit trail entries, as represented by the enclosing class. |
Field Summary | |
---|---|
protected int |
index
The current logical index (in number of audit trail entries) in the buffer. |
protected long |
lastInsertPosition
The position at which the last audit trail entry was inserted into the backing buffer storage. |
protected long |
position
The current actual position in the backing buffer storage, in bytes offset from the beginning of the storage. |
protected StorageProvider |
provider
Storage provider which is used to allocate new buffer storages. |
protected int |
size
The number of audit trail entries contained in a buffer. |
protected RandomAccessStorage |
storage
The random access storage to back the buffer of audit trail entries. |
protected static java.lang.String |
STRING_ENCODING
Encoding used for storing strings in buffer storages. |
Constructor Summary | |
---|---|
ATERandomFileBuffer(ATERandomFileBuffer template)
Creates a new instance of this class, which is an exact copy, or clone, of the provided template instance. |
|
ATERandomFileBuffer(StorageProvider aProvider)
Creates and initializes a new instance of this class. |
Method Summary | |
---|---|
void |
append(AuditTrailEntry ate)
Appends a new audit trail entry to the end of this collection. |
void |
cleanup()
Cleans up any non-volatile resources (e.g. |
ATERandomFileBuffer |
cloneInstance()
Clones this instance. |
protected byte[] |
encode(AuditTrailEntry ate)
Encodes the given audit trail entry object into a sequence of bytes. |
protected void |
finalize()
Remove buffer file when this instance is garbage collected. |
AuditTrailEntry |
get(int ateIndex)
Retrieves the audit trail entry recorded at the specified position |
int |
index()
Retrieves the current internal, logical position of this collection. |
java.util.Iterator |
iterator()
Returns an iterator on the audit trail entries buffered in this collection. |
protected void |
navigateToIndex(int reqIndex)
Repositions the low-level layer to read from the specified index. |
protected AuditTrailEntry |
read()
Reads an audit trail entry from the current position of the data access layer. |
protected void |
resetPosition()
Resets the position of the data access layer to read the next audit trail entry from the first position. |
int |
size()
Retrieves the number of audit trail entries recorded in this instance. |
protected void |
skipBackward(int atesToSkip)
Repositions the position of the data access layer to skip the specified number of records towards the beginning of the file. |
protected void |
skipForward(int atesToSkip)
Repositions the position of the data access layer to skip the specified number of records towards the end of the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String STRING_ENCODING
protected int size
protected int index
protected long position
protected long lastInsertPosition
protected RandomAccessStorage storage
protected StorageProvider provider
Constructor Detail |
---|
public ATERandomFileBuffer(StorageProvider aProvider) throws java.io.IOException
aProvider
- storage provider used for backing this buffer.
java.io.IOException
public ATERandomFileBuffer(ATERandomFileBuffer template) throws java.io.IOException
template
- The template instance to be cloned.
java.io.IOException
Method Detail |
---|
public int size()
public int index()
public void append(AuditTrailEntry ate) throws java.io.IOException
Notice that a call to this method does not affect the current position audit trail entries are read from.
ate
- The audit trail entry to append
java.io.IOException
public AuditTrailEntry get(int ateIndex) throws java.io.IOException, java.lang.IndexOutOfBoundsException
ateIndex
- Position of the requested audit trail entry, defined
to be within [0, size()-1]
.
java.io.IOException
java.lang.IndexOutOfBoundsException
public java.util.Iterator iterator()
public void cleanup() throws java.io.IOException
java.io.IOException
protected void navigateToIndex(int reqIndex) throws java.io.IOException
reqIndex
- Index to position the file pointer to.
java.io.IOException
protected void resetPosition()
protected void skipForward(int atesToSkip) throws java.io.IOException
atesToSkip
- Number of records to be skipped.
java.io.IOException
protected void skipBackward(int atesToSkip) throws java.io.IOException
atesToSkip
- Number of records to be skipped.
java.io.IOException
protected AuditTrailEntry read() throws java.io.IOException
java.io.IOException
protected byte[] encode(AuditTrailEntry ate) throws java.io.IOException
ate
- The audit trail entry to be encoded.
java.io.IOException
public ATERandomFileBuffer cloneInstance() throws java.io.IOException
java.io.IOException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |