Package opennlp.tools.ml.maxent.io
Class BinaryQNModelWriter
java.lang.Object
opennlp.tools.ml.model.AbstractModelWriter
opennlp.tools.ml.AbstractMLModelWriter
opennlp.tools.ml.maxent.io.GISModelWriter
opennlp.tools.ml.maxent.io.QNModelWriter
opennlp.tools.ml.maxent.io.BinaryQNModelWriter
A
QNModelWriter
that writes models in a binary format.- See Also:
-
Constructor Summary
ConstructorDescriptionBinaryQNModelWriter
(AbstractModel model, DataOutputStream dos) BinaryQNModelWriter
(AbstractModel model, File f) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlyingDataOutputStream
.void
writeDouble
(double d) Writes a singledouble
to the underlyingDataOutputStream
.void
writeInt
(int i) Writes a singleint
to the underlyingDataOutputStream
.void
Writes aString
to the underlyingDataOutputStream
.Methods inherited from class opennlp.tools.ml.maxent.io.QNModelWriter
persist
-
Constructor Details
-
BinaryQNModelWriter
InstantiatesBinaryQNModelWriter
via anQN model
and aFile
.Prepares writing of a
model
to the file. Based on whether the file's suffix contains.gz
, it detects whether the file is gzipped or not.- Parameters:
model
- TheQN model
which is to be persisted.f
- TheFile
in which the model is to be persisted.- Throws:
IOException
- Thrown if IO errors occurred.- See Also:
-
BinaryQNModelWriter
- Parameters:
model
- TheQN model
which is to be persisted.dos
- TheDataOutputStream
which is used to persist themodel
. Thedos
must be opened.- See Also:
-
-
Method Details
-
writeUTF
Writes aString
to the underlyingDataOutputStream
.- Specified by:
writeUTF
in classAbstractModelWriter
- Parameters:
s
- TheUTF encoded
characters.- Throws:
IOException
- Thrown if IO errors occurred.
-
writeInt
Writes a singleint
to the underlyingDataOutputStream
.- Specified by:
writeInt
in classAbstractModelWriter
- Parameters:
i
- Theint
value.- Throws:
IOException
- Thrown if IO errors occurred.
-
writeDouble
Writes a singledouble
to the underlyingDataOutputStream
.- Specified by:
writeDouble
in classAbstractModelWriter
- Parameters:
d
- Thedouble
value.- Throws:
IOException
- Thrown if IO errors occurred.
-
close
Closes the underlyingDataOutputStream
.- Specified by:
close
in classAbstractModelWriter
- Throws:
IOException
- Thrown if IO errors occurred.
-