|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.jbase.BufferedRandomAccessPersister
public class BufferedRandomAccessPersister
The BufferedRandomAccessPersister caches data in a hash table, and
delegates the real i/o operations to an underlying delegate
RandomAccessPersister.
Note that all cache-access is thread safe. If the caller guarantees that atomic read and write operations do not overlap, the class is thread-safe, even if concurrent read operations are overlapping.
| Constructor Summary | |
|---|---|
BufferedRandomAccessPersister(File file,
int tableSize,
int entrySize)
Constructor using a RandomAccessFilePersistor as delegate, and
a cache acording to the specified specifications. |
|
BufferedRandomAccessPersister(RandomAccessPersister delegate,
int tableSize,
int entrySize)
Constructor with delegate persistor and cache specifications. |
|
| Method Summary | |
|---|---|
void |
close(boolean erase)
Closes this persistor, subsequent read or write calls will cause an exception. |
RandomAccessPersister |
createReadCopy(ReadWriteLock lock)
Override to specialize return type |
void |
flush()
Ensures that any possibly cached data is written to the underlying store |
protected void |
flushDirtyEntry(RandomAccessPersister delegate,
ch.javasoft.jbase.BufferedRandomAccessPersister.TableEntry entry)
PRECONDITION: read or write lock held |
DataInput |
getInput()
Returns a data input object to read from. |
DataOutput |
getOutput()
Returns a data input object to write to. |
long |
getPosition()
Returns the current byte position. |
void |
setLength(long byteLength)
Sets the length of the storage. |
void |
setPosition(long bytePos)
Sets the byte offset position. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedRandomAccessPersister(File file,
int tableSize,
int entrySize)
throws FileNotFoundException
RandomAccessFilePersistor as delegate, and
a cache acording to the specified specifications.
Notes:
Recommended values:
file - file to create a RandomAccessFilePersistortableSize - number of entries in the hash tableentrySize - buffer byte length of a single hash table entry
FileNotFoundException - if the specified file is not found
public BufferedRandomAccessPersister(RandomAccessPersister delegate,
int tableSize,
int entrySize)
Notes:
Recommended values:
delegate - delegate persistor, does the real i/o operationstableSize - number of entries in the hash tableentrySize - buffer byte length of a single hash table entry| Method Detail |
|---|
public DataInput getInput()
throws IOException
RandomAccessPersister
getInput in interface RandomAccessPersisterIOException
public DataOutput getOutput()
throws IOException
RandomAccessPersister
getOutput in interface RandomAccessPersisterIOException
public long getPosition()
throws IOException
RandomAccessPersister
getPosition in interface RandomAccessPersisterIOException
public void setPosition(long bytePos)
throws IOException
RandomAccessPersister
setPosition in interface RandomAccessPersisterIOException
public void setLength(long byteLength)
throws IOException
RandomAccessPersister
setLength in interface RandomAccessPersisterIOException
public void flush()
throws IOException
RandomAccessPersister
flush in interface RandomAccessPersisterIOException
protected void flushDirtyEntry(RandomAccessPersister delegate,
ch.javasoft.jbase.BufferedRandomAccessPersister.TableEntry entry)
throws IOException
IOException
public void close(boolean erase)
throws IOException
RandomAccessPersister
close in interface RandomAccessPersistererase - if true, underlying files are deleted upon close
IOException
public RandomAccessPersister createReadCopy(ReadWriteLock lock)
throws IOException
RandomAccessPersister
createReadCopy in interface StatefulcreateReadCopy in interface RandomAccessPersisterlock - A read/write lock, the write lock is held. The lock,
however, might also be used for other functionality of the
returned read copy, for instance, if the read copy has to
be put in sync with the main object.
IOExceptionStateful.createReadCopy(ReadWriteLock)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||