public class PrincetonResourceDictionaryFile extends AbstractPrincetonRandomAccessDictionaryFile implements DictionaryFileFactory<PrincetonResourceDictionaryFile>
encoding, ENCODING_KEYdictionary, fileType, params, path, pos| Constructor and Description |
|---|
PrincetonResourceDictionaryFile(Dictionary dictionary,
java.util.Map<java.lang.String,Param> params)
Factory constructor.
|
PrincetonResourceDictionaryFile(Dictionary dictionary,
java.lang.String path,
POS pos,
DictionaryFileType fileType,
java.util.Map<java.lang.String,Param> params)
Instance constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the file.
|
static void |
copyStream(java.io.InputStream input,
java.io.OutputStream output) |
void |
edit()
Reopens file in write mode.
|
long |
getFirstLineOffset()
Returns offset of the first line.
|
long |
getNextLineOffset(long offset)
Returns start of the next line or -1 if no new line.
|
int |
getOffsetLength()
Returns offset length that accommodates largest offset.
|
boolean |
isOpen()
Returns true if the file is open.
|
long |
length()
Returns the length, in bytes, of the file.
|
PrincetonResourceDictionaryFile |
newInstance(Dictionary dictionary,
java.lang.String path,
POS pos,
DictionaryFileType fileType)
Creates a new instance of dictionary file.
|
void |
open()
Opens the file.
|
PointedCharSequence |
readLine(long offset)
Reads starting at offset and till the end of line.
|
PointedCharSequence |
readWord(long offset)
Reads starting at offset and till space.
|
void |
save()
Saves the file.
|
void |
setOffsetLength(int length)
Sets offset length to be used while rendering the file.
|
getFilenamegetDictionary, getFileType, getPOS, setDictionaryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFilename, getFileType, getPOSgetDictionary, setDictionarypublic PrincetonResourceDictionaryFile(Dictionary dictionary, java.util.Map<java.lang.String,Param> params)
dictionary - dictionaryparams - paramspublic PrincetonResourceDictionaryFile(Dictionary dictionary, java.lang.String path, POS pos, DictionaryFileType fileType, java.util.Map<java.lang.String,Param> params)
dictionary - dictionarypath - file pathpos - part of speechfileType - file typeparams - paramspublic PrincetonResourceDictionaryFile newInstance(Dictionary dictionary, java.lang.String path, POS pos, DictionaryFileType fileType)
DictionaryFileFactorynewInstance in interface DictionaryFileFactory<PrincetonResourceDictionaryFile>dictionary - owner dictionarypath - path to dictionary filespos - part of speechfileType - file typepublic void open()
throws JWNLException
DictionaryFileopen in interface DictionaryFileJWNLException - JWNLExceptionpublic boolean isOpen()
DictionaryFileisOpen in interface DictionaryFilepublic void close()
DictionaryFileclose in interface DictionaryFilepublic void save()
throws JWNLException
DictionaryFilesave in interface DictionaryFileJWNLException - JWNLExceptionpublic void edit()
throws JWNLException
DictionaryFileedit in interface DictionaryFileJWNLException - JWNLExceptionpublic long getFirstLineOffset()
throws JWNLException
RandomAccessDictionaryFilegetFirstLineOffset in interface RandomAccessDictionaryFileJWNLException - JWNLExceptionpublic long getNextLineOffset(long offset)
throws JWNLException
RandomAccessDictionaryFilegetNextLineOffset in interface RandomAccessDictionaryFileoffset - starting offsetJWNLException - JWNLExceptionpublic int getOffsetLength()
throws JWNLException
RandomAccessDictionaryFilegetOffsetLength in interface RandomAccessDictionaryFileJWNLException - JWNLExceptionpublic void setOffsetLength(int length)
throws JWNLException
RandomAccessDictionaryFilesetOffsetLength in interface RandomAccessDictionaryFilelength - offset length to be used while rendering the fileJWNLException - JWNLExceptionpublic PointedCharSequence readLine(long offset) throws JWNLException
RandomAccessDictionaryFilereadLine in interface RandomAccessDictionaryFileoffset - offsetJWNLException - JWNLExceptionpublic PointedCharSequence readWord(long offset) throws JWNLException
RandomAccessDictionaryFilereadWord in interface RandomAccessDictionaryFileoffset - offsetJWNLException - JWNLExceptionpublic long length()
throws JWNLException
RandomAccessDictionaryFilelength in interface RandomAccessDictionaryFileJWNLException - JWNLExceptionpublic static void copyStream(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOException