|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.acorn.io.RecordAccessFile
public class RecordAccessFile
A record oriented RandomAccessFile.
| Nested Class Summary | |
|---|---|
protected static class |
RecordAccessFile.RecordHeader
A header for records. |
| Field Summary | |
|---|---|
static int |
DEFAULT_CAPACITY
The default capcacity. |
static int |
DEFAULT_RECORD_LENGTH
The default record length. |
| Constructor Summary | |
|---|---|
RecordAccessFile(File file,
String mode)
Constructs a record access file. |
|
RecordAccessFile(File file,
String mode,
int capacity)
Constructs a record access file, initializing the appropriate headers. |
|
RecordAccessFile(File file,
String mode,
int capacity,
int recordLength)
Constructs a record access file, initializing the appropriate headers. |
|
| Method Summary | |
|---|---|
void |
acquire()
Acquires an exclusive lock to this record. |
void |
addRecord(String key,
RecordWriter rec)
Adds a new record. |
void |
clear()
Clears the file. |
void |
close()
Closes the file. |
boolean |
containsRecord(String key)
Checks if there is a record with the given key. |
File |
getFile()
Gets the file. |
RecordReader |
getRecord(String key)
Gets a record. |
boolean |
getRecord(String key,
RecordReader rec)
Gets a record. |
Set |
keySet()
Return the keys of all records in the file. |
void |
putRecord(String key,
RecordWriter rec)
Puts a record. |
int |
recordCount()
Returns the number or records in the file. |
void |
release()
Releases an exclusive lock to this record. |
boolean |
removeRecord(String key)
Removes a record. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_CAPACITY
public static final int DEFAULT_RECORD_LENGTH
| Constructor Detail |
|---|
public RecordAccessFile(File file,
String mode)
throws IOException
file - the internal file.mode - the access mode.
IOException - on I/O errors.
public RecordAccessFile(File file,
String mode,
int capacity)
throws IOException
file - the internal file.mode - the access mode.capacity - the initial capacity (0 = use default).
IOException - on I/O errors.
public RecordAccessFile(File file,
String mode,
int capacity,
int recordLength)
throws IOException
file - the internal file.mode - the access mode.capacity - the initial capacity (0 = use default).recordLength - the default record length (0 = use default).
IOException - on I/O errors.| Method Detail |
|---|
public File getFile()
public RecordReader getRecord(String key)
throws IOException
key - the record key.
IOException - on I/O errors.
public boolean getRecord(String key,
RecordReader rec)
throws IOException
key - the record key.rec - a record reader.
IOException - on I/O errors.
public void putRecord(String key,
RecordWriter rec)
throws IOException
key - the record key.rec - a record writer.
IOException - on I/O errors.
public void addRecord(String key,
RecordWriter rec)
throws IOException
key - the record key.rec - a record writer.
IOException - on I/O errors.
public boolean removeRecord(String key)
throws IOException
key - the record key.
IOException - on I/O errors.public Set keySet()
public int recordCount()
public boolean containsRecord(String key)
key - the record key.
public void clear()
throws IOException
IOException - on I/O errors.
public void close()
throws IOException
IOException - on I/O errors.public void acquire()
public void release()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||