public class PrincetonChannelDictionaryFile extends AbstractPrincetonRandomAccessDictionaryFile
RandomAccessDictionaryFile that accesses files named with Princeton's dictionary file naming convention.
Uses java.nio.channels.FileChannel for file access.| Modifier and Type | Field and Description |
|---|---|
private java.nio.CharBuffer |
_buffer
The random-access file.
|
private java.nio.channels.FileChannel |
_channel |
COMMENT_HEADER| Constructor and Description |
|---|
PrincetonChannelDictionaryFile() |
PrincetonChannelDictionaryFile(java.lang.String path,
POS pos,
DictionaryFileType fileType) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the file
|
long |
getFilePointer()
Get the current position of the file pointer.
|
boolean |
isOpen()
Return true if the file is open
|
long |
length()
Get the length, in bytes, of the file
|
DictionaryFile |
newInstance(java.lang.String path,
POS pos,
DictionaryFileType fileType)
Create a new instance of the dictionary file
|
protected void |
openFile(java.io.File file)
Open the file at path
path |
int |
read()
Read a byte from the file
|
java.lang.String |
readLine()
Read a line from the file
|
void |
seek(long pos)
Go to postion pos in the file.
|
getNextLineOffset, isPreviousLineOffset, setNextLineOffsetmakeFilenamegetFile, getFileType, getPOS, openclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFile, getFileType, getPOS, openprivate java.nio.CharBuffer _buffer
private java.nio.channels.FileChannel _channel
public PrincetonChannelDictionaryFile()
public PrincetonChannelDictionaryFile(java.lang.String path,
POS pos,
DictionaryFileType fileType)
public DictionaryFile newInstance(java.lang.String path, POS pos, DictionaryFileType fileType)
DictionaryFilepublic java.lang.String readLine()
throws java.io.IOException
RandomAccessDictionaryFilejava.io.IOExceptionpublic void seek(long pos)
throws java.io.IOException
RandomAccessDictionaryFilejava.io.IOExceptionpublic long getFilePointer()
throws java.io.IOException
RandomAccessDictionaryFilejava.io.IOExceptionpublic boolean isOpen()
DictionaryFilepublic void close()
DictionaryFileprotected void openFile(java.io.File file)
throws java.io.IOException
AbstractDictionaryFilepathopenFile in class AbstractDictionaryFilejava.io.IOExceptionpublic long length()
throws java.io.IOException
RandomAccessDictionaryFilejava.io.IOExceptionpublic int read()
throws java.io.IOException
RandomAccessDictionaryFilejava.io.IOException