Public Member Functions | |
CacheFile (String fName, Integer key, RandomAccessFile rf, File f) | |
File | getFile () throws FileNotFoundException |
void | close () |
long | getFileLength () |
synchronized CacheEntry | writeOnFile (String str, Integer key) throws IOException |
synchronized String | readFromFile (CacheEntry entry) throws IOException |
synchronized void | setReadingMode (boolean reading) |
synchronized void | setWritingMode (boolean writing) |
Public Attributes | |
final String | fileName |
final Integer | key |
Private Member Functions | |
void | openFile () throws FileNotFoundException |
void | checkRaFileUsage () |
Private Attributes | |
RandomAccessFile | raFile = null |
File | file = null |
boolean | reading = false |
boolean | writing = false |
The cache is composed by
|
Constructor
|
|
Check if the file is used for reading or writing and if not used, close the random file. |
|
Release all the resources (for instance it releases the random file). |
|
An helper methods that returns the
As soon as
A new File is built if
|
|
Return the size of the file
|
|
An helper method that returns a
The random access file is built from the
|
|
Read a string from the file
|
|
Set the reading mode of the file.
|
|
Set the writing mode of the file.
|
|
Write the passed string in the file.
|
|
The file used to build It is not null as soon as raFile is not null |
|
The name of the file |
|
The key identifying this file. The key is stored only to perform run-time tests of correctness. |
|
The
This is not |
|
Signal if the file is used for reading |
|
Signal if the file is used for writing |