public interface FileManager extends Owned
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.Modifier and Type | Method and Description |
---|---|
void |
close()
Shuts down the file manager.
|
boolean |
delete()
Deletes the dictionary.
|
void |
edit()
Reopens files for writing.
|
long |
getFirstLineOffset(POS pos,
DictionaryFileType fileType)
Returns the offset of the first valid line in the file (i.e.
|
PointedCharSequence |
getIndexedLine(POS pos,
DictionaryFileType fileType,
java.lang.String index)
Returns the line whose first word is index or null if not found.
|
PointedCharSequence |
getMatchingLine(POS pos,
DictionaryFileType fileType,
long offset,
java.lang.String substring)
Returns the line whose index word contains substring,
starting at offset or null if not found.
|
PointedCharSequence |
getRandomLine(POS pos,
DictionaryFileType fileType)
Returns a randomly-chosen line.
|
int |
getUseCount(java.lang.String senseKey)
Returns the number of times the sense marked by senseKey occurs in a semantic concordance.
|
PointedCharSequence |
readLineAt(POS pos,
DictionaryFileType fileType,
long offset)
Returns the line that begins at file offset offset.
|
void |
save()
Saves the files.
|
getDictionary, setDictionary
PointedCharSequence getIndexedLine(POS pos, DictionaryFileType fileType, java.lang.String index) throws JWNLException
pos
- part of speechfileType
- file typeindex
- word to search forJWNLException
- JWNLExceptionPointedCharSequence readLineAt(POS pos, DictionaryFileType fileType, long offset) throws JWNLException
pos
- part of speechfileType
- file typeoffset
- file offsetJWNLException
- JWNLExceptionPointedCharSequence getMatchingLine(POS pos, DictionaryFileType fileType, long offset, java.lang.String substring) throws JWNLException
pos
- part of speechfileType
- file typeoffset
- file offsetsubstring
- substring to search for in indexwordJWNLException
- JWNLExceptionPointedCharSequence getRandomLine(POS pos, DictionaryFileType fileType) throws JWNLException
pos
- part of speechfileType
- file typeJWNLException
- JWNLExceptionlong getFirstLineOffset(POS pos, DictionaryFileType fileType) throws JWNLException
pos
- part of speechfileType
- file typeJWNLException
- JWNLExceptionint getUseCount(java.lang.String senseKey) throws JWNLException
senseKey
- sense keyJWNLException
- JWNLExceptionvoid close() throws JWNLException
JWNLException
- JWNLExceptionvoid save() throws JWNLException
JWNLException
- JWNLExceptionboolean delete() throws JWNLException
JWNLException
- JWNLExceptionvoid edit() throws JWNLException
JWNLException
- JWNLException