net.didion.jwnl.princeton.file
Class PrincetonRandomAccessDictionaryFile

java.lang.Object
  extended bynet.didion.jwnl.dictionary.file.AbstractDictionaryFile
      extended bynet.didion.jwnl.princeton.file.AbstractPrincetonDictionaryFile
          extended bynet.didion.jwnl.princeton.file.AbstractPrincetonRandomAccessDictionaryFile
              extended bynet.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
protected  java.lang.String _permissions
          The file permissions to use when opening a file.
static java.lang.String READ_ONLY
          Read-only file permission.
static java.lang.String READ_WRITE
          Read-write file permission.
 
Fields inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
COMMENT_HEADER
 
Constructor Summary
PrincetonRandomAccessDictionaryFile()
           
PrincetonRandomAccessDictionaryFile(java.lang.String path, POS pos, DictionaryFileType fileType)
           
PrincetonRandomAccessDictionaryFile(java.lang.String path, POS pos, DictionaryFileType fileType, java.lang.String permissions)
           
 
Method Summary
 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 path)
          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.
 
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 java.lang.String READ_ONLY
Read-only file permission.

See Also:
Constant Field Values

READ_WRITE

public static final java.lang.String READ_WRITE
Read-write file permission.

See Also:
Constant Field Values

_permissions

protected java.lang.String _permissions
The file permissions to use when opening a file.

Constructor Detail

PrincetonRandomAccessDictionaryFile

public PrincetonRandomAccessDictionaryFile()

PrincetonRandomAccessDictionaryFile

public PrincetonRandomAccessDictionaryFile(java.lang.String path,
                                           POS pos,
                                           DictionaryFileType fileType)

PrincetonRandomAccessDictionaryFile

public PrincetonRandomAccessDictionaryFile(java.lang.String path,
                                           POS pos,
                                           DictionaryFileType fileType,
                                           java.lang.String permissions)
Method Detail

newInstance

public DictionaryFile newInstance(java.lang.String path,
                                  POS pos,
                                  DictionaryFileType fileType)
Description copied from interface: DictionaryFile
Create a new instance of the dictionary file


readLine

public java.lang.String readLine()
                          throws java.io.IOException
Description copied from interface: RandomAccessDictionaryFile
Read a line from the file

Throws:
java.io.IOException

seek

public void seek(long pos)
          throws java.io.IOException
Description copied from interface: RandomAccessDictionaryFile
Go to postion pos in the file.

Throws:
java.io.IOException

getFilePointer

public long getFilePointer()
                    throws java.io.IOException
Description copied from interface: RandomAccessDictionaryFile
Get the current position of the file pointer.

Throws:
java.io.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

protected void openFile(java.io.File path)
                 throws java.io.IOException
Description copied from class: AbstractDictionaryFile
Open the file at path path

Specified by:
openFile in class AbstractDictionaryFile
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Description copied from interface: RandomAccessDictionaryFile
Get the length, in bytes, of the file

Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Description copied from interface: RandomAccessDictionaryFile
Read a byte from the file

Throws:
java.io.IOException



JWNL homepage.