public class PersistentList
extends java.lang.Object
The file format is:
header + node1 + node2 + ...
where header is:
History:
Modifier and Type | Field and Description |
---|---|
static int |
HEADER_OFFSET
the size of header used in binary file
|
Constructor and Description |
---|
PersistentList(java.lang.String path)
Create an object of persistent list, using a string for the path of
the binary file to be strored.
|
Modifier and Type | Method and Description |
---|---|
void |
Add(PersistentListNode node)
Add a persistent node to the current persistent list.
|
void |
Close()
Close the random access file of current persistent list.
|
long |
GetAddress()
Get the beginning address of current persistent list.
|
java.io.RandomAccessFile |
GetRaf()
Get the random access file of the current persistent list.
|
static void |
main(java.lang.String[] args)
A test driver for this class.
|
public static final int HEADER_OFFSET
public PersistentList(java.lang.String path)
path
- the path of persistent RAF filepublic void Add(PersistentListNode node) throws java.io.IOException
node
- the persistent node to be addedjava.io.IOException
- if probelms happens when accessing random access
filepublic long GetAddress()
public java.io.RandomAccessFile GetRaf()
public void Close() throws java.io.IOException
java.io.IOException
- if probelms happens when closing random access
filepublic static void main(java.lang.String[] args)
args
- arguments