net.didion.jwnl.dictionary.file_manager
Interface FileManager

All Superinterfaces:
Createable, java.rmi.Remote
All Known Implementing Classes:
FileManagerImpl, RemoteFileManager

public interface FileManager
extends java.rmi.Remote, Createable

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
 void close()
          Shut down the file manager.
 long getFirstLinePointer(POS pos, DictionaryFileType fileType)
          Return the first valid line pointer in the specified file.
 long getIndexedLinePointer(POS pos, DictionaryFileType fileType, java.lang.String index)
          Search for the line whose first word is index (that is, that begins with index followed by a space or tab).
 long getMatchingLinePointer(POS pos, DictionaryFileType fileType, long offset, java.lang.String substring)
          Search for a line whose index word contains substring, starting at offset.
 long getNextLinePointer(POS pos, DictionaryFileType fileType, long offset)
          Search for the line following the line that begins at offset.
 long getRandomLinePointer(POS pos, DictionaryFileType index)
          Return a randomly-chosen line pointer (offset of the beginning of a line).
 java.lang.String readLineAt(POS pos, DictionaryFileType fileType, long offset)
          Read the line that begins at file offset offset.
 
Methods inherited from interface net.didion.jwnl.util.factory.Createable
create
 

Method Detail

getIndexedLinePointer

long getIndexedLinePointer(POS pos,
                           DictionaryFileType fileType,
                           java.lang.String index)
                           throws java.io.IOException,
                                  java.rmi.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 -1 if no such line exists.
Throws:
java.io.IOException
java.rmi.RemoteException

readLineAt

java.lang.String readLineAt(POS pos,
                            DictionaryFileType fileType,
                            long offset)
                            throws java.io.IOException,
                                   java.rmi.RemoteException
Read the line that begins at file offset offset.

Throws:
java.io.IOException
java.rmi.RemoteException

getNextLinePointer

long getNextLinePointer(POS pos,
                        DictionaryFileType fileType,
                        long offset)
                        throws java.io.IOException,
                               java.rmi.RemoteException
Search for the line following the line that begins at offset.

Returns:
The file offset of the start of the line, or -1 if offset is the last line in the file.
Throws:
java.io.IOException
java.rmi.RemoteException

getMatchingLinePointer

long getMatchingLinePointer(POS pos,
                            DictionaryFileType fileType,
                            long offset,
                            java.lang.String substring)
                            throws java.io.IOException,
                                   java.rmi.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 -1 if no such line exists.
Throws:
java.io.IOException
java.rmi.RemoteException

getRandomLinePointer

long getRandomLinePointer(POS pos,
                          DictionaryFileType index)
                          throws java.io.IOException
Return a randomly-chosen line pointer (offset of the beginning of a line).

Parameters:
pos -
index -
Returns:
Throws:
java.io.IOException

getFirstLinePointer

long getFirstLinePointer(POS pos,
                         DictionaryFileType fileType)
                         throws java.io.IOException
Return the first valid line pointer in the specified file.

Parameters:
pos -
fileType -
Returns:
Throws:
java.io.IOException

close

void close()
Shut down the file manager.