Package net.didion.jwnl.princeton.file
Class PrincetonChannelDictionaryFile
- 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.PrincetonChannelDictionaryFile
-
- All Implemented Interfaces:
DictionaryFile,RandomAccessDictionaryFile
public class PrincetonChannelDictionaryFile extends AbstractPrincetonRandomAccessDictionaryFile
ARandomAccessDictionaryFilethat accesses files named with Princeton's dictionary file naming convention. Uses java.nio.channels.FileChannel for file access.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.CharBuffer_bufferThe random-access file.private java.nio.channels.FileChannel_channel-
Fields inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
COMMENT_HEADER
-
-
Constructor Summary
Constructors Constructor Description PrincetonChannelDictionaryFile()PrincetonChannelDictionaryFile(java.lang.String path, POS pos, DictionaryFileType fileType)
-
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(java.lang.String path, POS pos, DictionaryFileType fileType)Create a new instance of the dictionary fileprotected voidopenFile(java.io.File file)Open the file at pathpathintread()Read a byte from the filejava.lang.StringreadLine()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
-
-
-
-
Constructor Detail
-
PrincetonChannelDictionaryFile
public PrincetonChannelDictionaryFile()
-
PrincetonChannelDictionaryFile
public PrincetonChannelDictionaryFile(java.lang.String path, POS pos, DictionaryFileType fileType)
-
-
Method Detail
-
newInstance
public DictionaryFile newInstance(java.lang.String path, POS pos, DictionaryFileType fileType)
Description copied from interface:DictionaryFileCreate a new instance of the dictionary file
-
readLine
public java.lang.String readLine() throws java.io.IOExceptionDescription copied from interface:RandomAccessDictionaryFileRead a line from the file- Throws:
java.io.IOException
-
seek
public void seek(long pos) throws java.io.IOExceptionDescription copied from interface:RandomAccessDictionaryFileGo to postion pos in the file.- Throws:
java.io.IOException
-
getFilePointer
public long getFilePointer() throws java.io.IOExceptionDescription copied from interface:RandomAccessDictionaryFileGet the current position of the file pointer.- Throws:
java.io.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(java.io.File file) throws java.io.IOExceptionDescription copied from class:AbstractDictionaryFileOpen the file at pathpath- Specified by:
openFilein classAbstractDictionaryFile- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOExceptionDescription copied from interface:RandomAccessDictionaryFileGet the length, in bytes, of the file- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOExceptionDescription copied from interface:RandomAccessDictionaryFileRead a byte from the file- Throws:
java.io.IOException
-
-