public abstract class AbstractPrincetonObjectDictionaryFile extends AbstractPrincetonDictionaryFile implements ObjectDictionaryFile
ObjectDictionaryFile
s that access files with the Princeton dictionary file naming convention.Modifier and Type | Field and Description |
---|---|
protected java.io.ObjectInputStream |
in |
protected java.io.ObjectOutputStream |
out |
dictionary, fileType, params, path, pos
Modifier | Constructor and Description |
---|---|
|
AbstractPrincetonObjectDictionaryFile(Dictionary dictionary,
java.util.Map<java.lang.String,Param> params)
Factory constructor.
|
protected |
AbstractPrincetonObjectDictionaryFile(Dictionary dictionary,
java.lang.String path,
POS pos,
DictionaryFileType fileType,
java.util.Map<java.lang.String,Param> params)
Instance constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canRead() |
protected boolean |
canWrite() |
void |
close()
Closes the file.
|
protected void |
closeStreams(java.io.InputStream in,
java.io.OutputStream out) |
void |
edit()
Reopens file in write mode.
|
protected java.io.ObjectInputStream |
getInputStream() |
protected java.io.ObjectOutputStream |
getOutputStream() |
boolean |
isOpen()
Returns true if the file is open.
|
abstract void |
open()
Here we try to be intelligent about opening streams.
|
protected abstract void |
openInputStream() |
protected abstract void |
openOutputStream() |
protected void |
openStreams()
Open the input and output streams.
|
java.lang.Object |
readObject()
Reads and deserializes an object from the file.
|
void |
save()
Saves the file.
|
void |
writeObject(java.lang.Object obj)
Serializes and write an object ot the file.
|
getFilename
getDictionary, getFileType, getPOS, setDictionary
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFilename, getFileType, getPOS
getDictionary, setDictionary
public AbstractPrincetonObjectDictionaryFile(Dictionary dictionary, java.util.Map<java.lang.String,Param> params)
dictionary
- dictionaryparams
- paramsprotected AbstractPrincetonObjectDictionaryFile(Dictionary dictionary, java.lang.String path, POS pos, DictionaryFileType fileType, java.util.Map<java.lang.String,Param> params)
dictionary
- dictionarypath
- file pathpos
- part of speechfileType
- file typeparams
- paramspublic boolean isOpen()
DictionaryFile
isOpen
in interface DictionaryFile
public void save() throws JWNLException
DictionaryFile
save
in interface DictionaryFile
JWNLException
- JWNLExceptionpublic void close()
DictionaryFile
close
in interface DictionaryFile
protected void closeStreams(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void edit() throws JWNLException
DictionaryFile
edit
in interface DictionaryFile
JWNLException
- JWNLExceptionprotected void openStreams() throws JWNLException
JWNLException
- JWNLExceptionprotected abstract void openOutputStream() throws JWNLException
JWNLException
protected abstract void openInputStream() throws JWNLException
JWNLException
protected java.io.ObjectInputStream getInputStream() throws JWNLException
JWNLException
protected java.io.ObjectOutputStream getOutputStream() throws JWNLException
JWNLException
protected boolean canRead()
protected boolean canWrite()
public java.lang.Object readObject() throws JWNLException
ObjectDictionaryFile
readObject
in interface ObjectDictionaryFile
JWNLException
- JWNLExceptionpublic void writeObject(java.lang.Object obj) throws JWNLException
ObjectDictionaryFile
writeObject
in interface ObjectDictionaryFile
obj
- object to writeJWNLException
- JWNLExceptionpublic abstract void open() throws JWNLException
openStreams
.open
in interface DictionaryFile
JWNLException
- JWNLException