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
ARandomAccessDictionaryFilethat accesses files named with Princeton's dictionary file naming convention.
-
-
Field Summary
Fields Modifier and Type Field Description protected String_permissionsThe file permissions to use when opening a file.static StringREAD_ONLYRead-only file permission.static StringREAD_WRITERead-write file permission.-
Fields inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
COMMENT_HEADER
-
-
Constructor Summary
Constructors Constructor Description PrincetonRandomAccessDictionaryFile()PrincetonRandomAccessDictionaryFile(String path, POS pos, DictionaryFileType fileType)PrincetonRandomAccessDictionaryFile(String path, POS pos, DictionaryFileType fileType, String permissions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the filelonggetFilePointer()Get the current position of the file pointer.booleanisOpen()Return true if the file is openlonglength()Get the length, in bytes, of the fileDictionaryFilenewInstance(String path, POS pos, DictionaryFileType fileType)Create a new instance of the dictionary fileprotected voidopenFile(File path)Open the file at pathpathintread()Read a byte from the fileStringreadLine()Read a line from the filevoidseek(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 Detail
-
READ_ONLY
public static final String READ_ONLY
Read-only file permission.- See Also:
- Constant Field Values
-
READ_WRITE
public static final String READ_WRITE
Read-write file permission.- See Also:
- Constant Field Values
-
_permissions
protected String _permissions
The file permissions to use when opening a file.
-
-
Constructor Detail
-
PrincetonRandomAccessDictionaryFile
public PrincetonRandomAccessDictionaryFile()
-
PrincetonRandomAccessDictionaryFile
public PrincetonRandomAccessDictionaryFile(String path, POS pos, DictionaryFileType fileType)
-
PrincetonRandomAccessDictionaryFile
public PrincetonRandomAccessDictionaryFile(String path, POS pos, DictionaryFileType fileType, String permissions)
-
-
Method Detail
-
newInstance
public DictionaryFile newInstance(String path, POS pos, DictionaryFileType fileType)
Description copied from interface:DictionaryFileCreate a new instance of the dictionary file
-
readLine
public String readLine() throws IOException
Description copied from interface:RandomAccessDictionaryFileRead a line from the file- Throws:
IOException
-
seek
public void seek(long pos) throws IOExceptionDescription copied from interface:RandomAccessDictionaryFileGo to postion pos in the file.- Throws:
IOException
-
getFilePointer
public long getFilePointer() throws IOExceptionDescription copied from interface:RandomAccessDictionaryFileGet the current position of the file pointer.- Throws:
IOException
-
isOpen
public boolean isOpen()
Description copied from interface:DictionaryFileReturn true if the file is open
-
close
public void close()
Description copied from interface:DictionaryFileClose the file
-
openFile
protected void openFile(File path) throws IOException
Description copied from class:AbstractDictionaryFileOpen the file at pathpath- Specified by:
openFilein classAbstractDictionaryFile- Throws:
IOException
-
length
public long length() throws IOExceptionDescription copied from interface:RandomAccessDictionaryFileGet the length, in bytes, of the file- Throws:
IOException
-
read
public int read() throws IOExceptionDescription copied from interface:RandomAccessDictionaryFileRead a byte from the file- Throws:
IOException
-
-