Package opennlp.tools.ml.model
Class GenericModelWriter
java.lang.Object
opennlp.tools.ml.model.AbstractModelWriter
opennlp.tools.ml.model.GenericModelWriter
An generic
AbstractModelWriter
implementation.- See Also:
-
Constructor Summary
ConstructorDescriptionGenericModelWriter
(AbstractModel model, DataOutputStream dos) Initializes aGenericModelWriter
for anAbstractModel
with an associatedDataOutputStream
the model shall be written to.GenericModelWriter
(AbstractModel model, File file) Initializes aGenericModelWriter
for anAbstractModel
with an associatedFile
the model shall be written to. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlyingDataOutputStream
.void
persist()
Serializes themodel
using theAbstractModelWriter.writeUTF(String)
,AbstractModelWriter.writeDouble(double)
, orAbstractModelWriter.writeInt(int)
} methods implemented by extending classes.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
.
-
Constructor Details
-
GenericModelWriter
Initializes aGenericModelWriter
for anAbstractModel
with an associatedFile
the model shall be written to.- Parameters:
model
- Themodel
to write out.file
- TheFile
that used to be written to.- Throws:
IOException
- Thrown if IO errors occurred.
-
GenericModelWriter
Initializes aGenericModelWriter
for anAbstractModel
with an associatedDataOutputStream
the model shall be written to.- Parameters:
model
- Themodel
to write out.dos
- TheDataOutputStream
that used to be written to.
-
-
Method Details
-
close
Description copied from class:AbstractModelWriter
Closes the underlyingDataOutputStream
.- Specified by:
close
in classAbstractModelWriter
- Throws:
IOException
- Thrown if IO errors occurred.
-
persist
Description copied from class:AbstractModelWriter
Serializes themodel
using theAbstractModelWriter.writeUTF(String)
,AbstractModelWriter.writeDouble(double)
, orAbstractModelWriter.writeInt(int)
} methods implemented by extending classes.- Specified by:
persist
in classAbstractModelWriter
- Throws:
IOException
- Thrown if IO errors occurred.
-
writeDouble
Description copied from class:AbstractModelWriter
Writes a singledouble
to the underlyingDataOutputStream
.- Specified by:
writeDouble
in classAbstractModelWriter
- Parameters:
d
- Thedouble
value.- Throws:
IOException
- Thrown if IO errors occurred.
-
writeInt
Description copied from class:AbstractModelWriter
Writes a singleint
to the underlyingDataOutputStream
.- Specified by:
writeInt
in classAbstractModelWriter
- Parameters:
i
- Theint
value.- Throws:
IOException
- Thrown if IO errors occurred.
-
writeUTF
Description copied from class:AbstractModelWriter
Writes aString
to the underlyingDataOutputStream
.- Specified by:
writeUTF
in classAbstractModelWriter
- Parameters:
s
- TheUTF encoded
characters.- Throws:
IOException
- Thrown if IO errors occurred.
-