Package net.didion.jwnl.princeton.file
Class PrincetonRandomAccessDictionaryFile
java.lang.Object
net.didion.jwnl.dictionary.file.AbstractDictionaryFile
net.didion.jwnl.princeton.file.AbstractPrincetonDictionaryFile
net.didion.jwnl.princeton.file.AbstractPrincetonRandomAccessDictionaryFile
net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile
- All Implemented Interfaces:
DictionaryFile
,RandomAccessDictionaryFile
public class PrincetonRandomAccessDictionaryFile
extends AbstractPrincetonRandomAccessDictionaryFile
A
RandomAccessDictionaryFile
that accesses files
named with Princeton's dictionary file naming convention.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RandomAccessFile
The random-access file.protected String
The file permissions to use when opening a file.static final String
Read-only file permission.static final String
Read-write file permission.Fields inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
COMMENT_HEADER
-
Constructor Summary
ConstructorsConstructorDescriptionPrincetonRandomAccessDictionaryFile
(String path, POS pos, DictionaryFileType fileType) PrincetonRandomAccessDictionaryFile
(String path, POS pos, DictionaryFileType fileType, String permissions) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the filelong
Get the current position of the file pointer.boolean
isOpen()
Return true if the file is openlong
length()
Get the length, in bytes, of the filenewInstance
(String path, POS pos, DictionaryFileType fileType) Create a new instance of the dictionary fileprotected void
Open the file at pathpath
int
read()
Read a byte from the filereadLine()
Read a line from the filevoid
seek
(long pos) Go to postion pos in the file.Methods inherited from class net.didion.jwnl.princeton.file.AbstractPrincetonRandomAccessDictionaryFile
getNextLineOffset, isPreviousLineOffset, setNextLineOffset
Methods inherited from class net.didion.jwnl.princeton.file.AbstractPrincetonDictionaryFile
makeFilename
Methods inherited from class net.didion.jwnl.dictionary.file.AbstractDictionaryFile
getFile, getFileType, getPOS, open
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
getFile, getFileType, getPOS, open
-
Field Details
-
READ_ONLY
Read-only file permission.- See Also:
-
READ_WRITE
Read-write file permission.- See Also:
-
_file
The random-access file. -
_permissions
The file permissions to use when opening a file.
-
-
Constructor Details
-
PrincetonRandomAccessDictionaryFile
public PrincetonRandomAccessDictionaryFile() -
PrincetonRandomAccessDictionaryFile
-
PrincetonRandomAccessDictionaryFile
public PrincetonRandomAccessDictionaryFile(String path, POS pos, DictionaryFileType fileType, String permissions)
-
-
Method Details
-
newInstance
Description copied from interface:DictionaryFile
Create a new instance of the dictionary file -
readLine
Description copied from interface:RandomAccessDictionaryFile
Read a line from the file- Throws:
IOException
-
seek
Description copied from interface:RandomAccessDictionaryFile
Go to postion pos in the file.- Throws:
IOException
-
getFilePointer
Description copied from interface:RandomAccessDictionaryFile
Get the current position of the file pointer.- Throws:
IOException
-
isOpen
public boolean isOpen()Description copied from interface:DictionaryFile
Return true if the file is open -
close
public void close()Description copied from interface:DictionaryFile
Close the file -
openFile
Description copied from class:AbstractDictionaryFile
Open the file at pathpath
- Specified by:
openFile
in classAbstractDictionaryFile
- Throws:
IOException
-
length
Description copied from interface:RandomAccessDictionaryFile
Get the length, in bytes, of the file- Throws:
IOException
-
read
Description copied from interface:RandomAccessDictionaryFile
Read a byte from the file- Throws:
IOException
-