public class PrincetonResourceDictionaryFile extends AbstractPrincetonRandomAccessDictionaryFile implements DictionaryFileFactory<PrincetonResourceDictionaryFile>
encoding, ENCODING_KEY
dictionary, 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.
|
getFilename
getDictionary, getFileType, getPOS, setDictionary
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFilename, getFileType, getPOS
getDictionary, setDictionary
public 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)
DictionaryFileFactory
newInstance
in interface DictionaryFileFactory<PrincetonResourceDictionaryFile>
dictionary
- owner dictionarypath
- path to dictionary filespos
- part of speechfileType
- file typepublic void open() throws JWNLException
DictionaryFile
open
in interface DictionaryFile
JWNLException
- JWNLExceptionpublic boolean isOpen()
DictionaryFile
isOpen
in interface DictionaryFile
public void close()
DictionaryFile
close
in interface DictionaryFile
public void save() throws JWNLException
DictionaryFile
save
in interface DictionaryFile
JWNLException
- JWNLExceptionpublic void edit() throws JWNLException
DictionaryFile
edit
in interface DictionaryFile
JWNLException
- JWNLExceptionpublic long getFirstLineOffset() throws JWNLException
RandomAccessDictionaryFile
getFirstLineOffset
in interface RandomAccessDictionaryFile
JWNLException
- JWNLExceptionpublic long getNextLineOffset(long offset) throws JWNLException
RandomAccessDictionaryFile
getNextLineOffset
in interface RandomAccessDictionaryFile
offset
- starting offsetJWNLException
- JWNLExceptionpublic int getOffsetLength() throws JWNLException
RandomAccessDictionaryFile
getOffsetLength
in interface RandomAccessDictionaryFile
JWNLException
- JWNLExceptionpublic void setOffsetLength(int length) throws JWNLException
RandomAccessDictionaryFile
setOffsetLength
in interface RandomAccessDictionaryFile
length
- offset length to be used while rendering the fileJWNLException
- JWNLExceptionpublic PointedCharSequence readLine(long offset) throws JWNLException
RandomAccessDictionaryFile
readLine
in interface RandomAccessDictionaryFile
offset
- offsetJWNLException
- JWNLExceptionpublic PointedCharSequence readWord(long offset) throws JWNLException
RandomAccessDictionaryFile
readWord
in interface RandomAccessDictionaryFile
offset
- offsetJWNLException
- JWNLExceptionpublic long length() throws JWNLException
RandomAccessDictionaryFile
length
in interface RandomAccessDictionaryFile
JWNLException
- JWNLExceptionpublic static void copyStream(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
java.io.IOException