Interface FileManager
- All Superinterfaces:
Createable, Remote
- All Known Implementing Classes:
FileManagerImpl, RemoteFileManager
FileManager defines the interface between the FileBackedDictionary and the file system.
Methods in this interface operate on and return offsets, which are indices into a dictionary file.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Shut down the file manager.longgetFirstLinePointer(POS pos, DictionaryFileType fileType) Return the first valid line pointer in the specified file.longgetIndexedLinePointer(POS pos, DictionaryFileType fileType, String index) Search for the line whose first word is index (that is, that begins with index followed by a space or tab).longgetMatchingLinePointer(POS pos, DictionaryFileType fileType, long offset, String substring) Search for a line whose index word contains substring, starting at offset.longgetNextLinePointer(POS pos, DictionaryFileType fileType, long offset) Search for the line following the line that begins at offset.longgetRandomLinePointer(POS pos, DictionaryFileType index) Return a randomly-chosen line pointer (offset of the beginning of a line).readLineAt(POS pos, DictionaryFileType fileType, long offset) Read the line that begins at file offset offset.Methods inherited from interface Createable
create
-
Method Details
-
getIndexedLinePointer
long getIndexedLinePointer(POS pos, DictionaryFileType fileType, String index) throws IOException, RemoteException Search for the line whose first word is index (that is, that begins with index followed by a space or tab).- Returns:
- The file offset of the start of the matching line, or
-1if no such line exists. - Throws:
IOExceptionRemoteException
-
readLineAt
String readLineAt(POS pos, DictionaryFileType fileType, long offset) throws IOException, RemoteException Read the line that begins at file offset offset.- Throws:
IOExceptionRemoteException
-
getNextLinePointer
long getNextLinePointer(POS pos, DictionaryFileType fileType, long offset) throws IOException, RemoteException Search for the line following the line that begins at offset.- Returns:
- The file offset of the start of the line, or
-1if offset is the last line in the file. - Throws:
IOExceptionRemoteException
-
getMatchingLinePointer
long getMatchingLinePointer(POS pos, DictionaryFileType fileType, long offset, String substring) throws IOException, RemoteException Search for a line whose index word contains substring, starting at offset.- Returns:
- The file offset of the start of the matchng line, or
-1if no such line exists. - Throws:
IOExceptionRemoteException
-
getRandomLinePointer
Return a randomly-chosen line pointer (offset of the beginning of a line).- Parameters:
pos-index-- Returns:
- Throws:
IOException
-
getFirstLinePointer
Return the first valid line pointer in the specified file.- Parameters:
pos-fileType-- Returns:
- Throws:
IOException
-
close
void close()Shut down the file manager.
-