public class PrincetonObjectDictionaryFile extends AbstractPrincetonDictionaryFile implements ObjectDictionaryFile
ObjectDictionaryFile that accesses files names with the Princeton dictionary file naming convention.| Modifier and Type | Field and Description |
|---|---|
private java.io.File |
_file |
private java.io.ObjectInputStream |
_in |
private java.io.ObjectOutputStream |
_out |
COMMENT_HEADER| Constructor and Description |
|---|
PrincetonObjectDictionaryFile() |
PrincetonObjectDictionaryFile(java.lang.String path,
POS pos,
DictionaryFileType fileType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead() |
boolean |
canWrite() |
void |
close()
Close the file
|
java.io.ObjectInputStream |
getInputStream() |
java.io.ObjectOutputStream |
getOutputStream() |
boolean |
isOpen()
Return true if the file is open
|
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)
Here we try to be intelligent about opening streams.
|
private void |
openInputStream() |
private void |
openOutputStream() |
void |
openStreams()
Open the input and output streams.
|
java.lang.Object |
readObject()
Read and deserialize an object from the file
|
void |
writeObject(java.lang.Object obj)
Serialize and write an object ot the file.
|
makeFilenamegetFile, getFileType, getPOS, openclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFile, getFileType, getPOS, openprivate java.io.File _file
private java.io.ObjectInputStream _in
private java.io.ObjectOutputStream _out
public PrincetonObjectDictionaryFile()
public PrincetonObjectDictionaryFile(java.lang.String path,
POS pos,
DictionaryFileType fileType)
public DictionaryFile newInstance(java.lang.String path, POS pos, DictionaryFileType fileType)
DictionaryFilenewInstance in interface DictionaryFilepublic boolean isOpen()
DictionaryFileisOpen in interface DictionaryFilepublic void close()
DictionaryFileclose in interface DictionaryFilepublic void openStreams()
throws java.io.IOException
java.io.IOExceptionprivate void openOutputStream()
throws java.io.IOException
java.io.IOExceptionprivate void openInputStream()
throws java.io.IOException
java.io.IOExceptionpublic java.io.ObjectInputStream getInputStream()
throws java.io.IOException
java.io.IOExceptionpublic java.io.ObjectOutputStream getOutputStream()
throws java.io.IOException
java.io.IOExceptionpublic boolean canRead()
public boolean canWrite()
public java.lang.Object readObject()
throws java.io.IOException,
java.lang.ClassNotFoundException
ObjectDictionaryFilereadObject in interface ObjectDictionaryFilejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic void writeObject(java.lang.Object obj)
throws java.io.IOException
ObjectDictionaryFilewriteObject in interface ObjectDictionaryFilejava.io.IOExceptionprotected void openFile(java.io.File path)
throws java.io.IOException
openStreams.openFile in class AbstractDictionaryFilejava.io.IOException