|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.extjwnl.dictionary.file.AbstractDictionaryFile
net.sf.extjwnl.princeton.file.AbstractPrincetonDictionaryFile
net.sf.extjwnl.princeton.file.AbstractPrincetonRandomAccessDictionaryFile
net.sf.extjwnl.princeton.file.PrincetonRandomAccessDictionaryFile
public class PrincetonRandomAccessDictionaryFile
A RandomAccessDictionaryFile
that accesses files
named with Princeton's dictionary file naming convention.
Field Summary | |
---|---|
static String |
CHECK_LEX_FILE_NUMBER_KEY
Whether to warn about lex file numbers correctness, default: true. |
static String |
CHECK_LEX_ID_LIMIT_KEY
Whether to warn about lex id being off limits, default: true. |
static String |
CHECK_OFFSET_LIMIT_KEY
Whether to warn about offsets being off limits, default: true. |
static String |
CHECK_POINTER_INDEX_LIMIT_KEY
Whether to warn about pointer target indices being off limits, default: true |
static String |
CHECK_RELATION_LIMIT_KEY
Whether to warn about relation count being off limits, default: true. |
static String |
CHECK_VERB_FRAME_LIMIT_KEY
Whether to warn about verb frame indices being off limits, default: true |
static String |
CHECK_WORD_COUNT_LIMIT_KEY
Whether to warn about word count being off limits, default: true. |
protected RandomAccessFile |
raFile
The random-access file. |
static String |
READ_ONLY
Read-only file permission. |
static String |
READ_WRITE
Read-write file permission. |
static String |
WRITE_PRINCETON_HEADER_KEY
Whether to add standard princeton header to files on save, default: false. |
Fields inherited from class net.sf.extjwnl.princeton.file.AbstractPrincetonRandomAccessDictionaryFile |
---|
encoding, ENCODING |
Fields inherited from class net.sf.extjwnl.dictionary.file.AbstractDictionaryFile |
---|
dictionary, file, params |
Constructor Summary | |
---|---|
PrincetonRandomAccessDictionaryFile(Dictionary dictionary,
Map<String,Param> params)
|
|
PrincetonRandomAccessDictionaryFile(Dictionary dictionary,
String path,
POS pos,
DictionaryFileType fileType,
Map<String,Param> params)
|
Method Summary | |
---|---|
void |
close()
Closes the file. |
void |
edit()
Reopens file in write mode. |
long |
getFilePointer()
Returns the current position of the file pointer. |
String |
getOffsetFormatString()
Returns offset format string that accommodates largest offset. |
boolean |
isOpen()
Returns true if the file is open. |
long |
length()
Returns the length, in bytes, of the file. |
PrincetonRandomAccessDictionaryFile |
newInstance(Dictionary dictionary,
String path,
POS pos,
DictionaryFileType fileType)
Creates a new instance of the dictionary file. |
protected void |
openFile()
Here we try to be intelligent about opening files. |
int |
read()
Reads a byte from the file. |
String |
readLine()
Reads a line from the file. |
String |
readLineWord()
Reads the first word from a file (ie offset, index word). |
void |
save()
Saves the file. |
void |
seek(long pos)
Goes to position pos in the file. |
void |
writeIndexStrings(ArrayList<String> strings)
|
void |
writeLine(String line)
Writes a line to the file. |
void |
writeStrings(Collection<String> strings)
Writes strings in file. |
Methods inherited from class net.sf.extjwnl.princeton.file.AbstractPrincetonRandomAccessDictionaryFile |
---|
getNextLineOffset, isPreviousLineOffset, setNextLineOffset |
Methods inherited from class net.sf.extjwnl.princeton.file.AbstractPrincetonDictionaryFile |
---|
getFilename |
Methods inherited from class net.sf.extjwnl.dictionary.file.AbstractDictionaryFile |
---|
delete, getDictionary, getFile, getFileType, getPOS, open, setDictionary |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.extjwnl.dictionary.file.DictionaryFile |
---|
delete, getFile, getFileType, getPOS, open |
Methods inherited from interface net.sf.extjwnl.util.factory.Owned |
---|
getDictionary, setDictionary |
Field Detail |
---|
public static final String WRITE_PRINCETON_HEADER_KEY
public static final String CHECK_LEX_FILE_NUMBER_KEY
public static final String CHECK_RELATION_LIMIT_KEY
public static final String CHECK_OFFSET_LIMIT_KEY
public static final String CHECK_WORD_COUNT_LIMIT_KEY
public static final String CHECK_LEX_ID_LIMIT_KEY
public static final String CHECK_POINTER_INDEX_LIMIT_KEY
public static final String CHECK_VERB_FRAME_LIMIT_KEY
public static final String READ_ONLY
public static final String READ_WRITE
protected RandomAccessFile raFile
Constructor Detail |
---|
public PrincetonRandomAccessDictionaryFile(Dictionary dictionary, Map<String,Param> params)
public PrincetonRandomAccessDictionaryFile(Dictionary dictionary, String path, POS pos, DictionaryFileType fileType, Map<String,Param> params)
Method Detail |
---|
public PrincetonRandomAccessDictionaryFile newInstance(Dictionary dictionary, String path, POS pos, DictionaryFileType fileType)
DictionaryFileFactory
newInstance
in interface DictionaryFileFactory<PrincetonRandomAccessDictionaryFile>
dictionary
- owner dictionarypath
- path to dictionary filespos
- part of speechfileType
- file type
public String readLine() throws IOException
RandomAccessDictionaryFile
readLine
in interface RandomAccessDictionaryFile
IOException
- IOExceptionpublic String readLineWord() throws IOException
RandomAccessDictionaryFile
readLineWord
in interface RandomAccessDictionaryFile
IOException
- IOExceptionpublic void seek(long pos) throws IOException
RandomAccessDictionaryFile
seek
in interface RandomAccessDictionaryFile
pos
- position pos in the file
IOException
- IOExceptionpublic long getFilePointer() throws IOException
RandomAccessDictionaryFile
getFilePointer
in interface RandomAccessDictionaryFile
IOException
- IOExceptionpublic boolean isOpen()
DictionaryFile
isOpen
in interface DictionaryFile
public void close()
DictionaryFile
close
in interface DictionaryFile
close
in class AbstractDictionaryFile
protected void openFile() throws IOException
openFile
in class AbstractDictionaryFile
IOException
- IOExceptionpublic void edit() throws IOException
DictionaryFile
edit
in interface DictionaryFile
edit
in class AbstractPrincetonRandomAccessDictionaryFile
IOException
- IOExceptionpublic long length() throws IOException
RandomAccessDictionaryFile
length
in interface RandomAccessDictionaryFile
IOException
- IOExceptionpublic int read() throws IOException
RandomAccessDictionaryFile
read
in interface RandomAccessDictionaryFile
IOException
- IOExceptionpublic void save() throws IOException, JWNLException
DictionaryFile
save
in interface DictionaryFile
IOException
- IOException
JWNLException
- JWNLExceptionpublic void writeLine(String line) throws IOException
RandomAccessDictionaryFile
writeLine
in interface RandomAccessDictionaryFile
writeLine
in class AbstractPrincetonRandomAccessDictionaryFile
line
- a line to write
IOException
- IOExceptionpublic void writeStrings(Collection<String> strings) throws IOException
RandomAccessDictionaryFile
writeStrings
in interface RandomAccessDictionaryFile
writeStrings
in class AbstractPrincetonRandomAccessDictionaryFile
strings
- strings to write
IOException
- IOExceptionpublic void writeIndexStrings(ArrayList<String> strings) throws IOException
IOException
public String getOffsetFormatString()
RandomAccessDictionaryFile
getOffsetFormatString
in interface RandomAccessDictionaryFile
getOffsetFormatString
in class AbstractPrincetonRandomAccessDictionaryFile
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |