Package opennlp.tools.ml.model
Class GenericModelWriter
- java.lang.Object
-
- opennlp.tools.ml.model.AbstractModelWriter
-
- opennlp.tools.ml.model.GenericModelWriter
-
public class GenericModelWriter extends AbstractModelWriter
An genericAbstractModelWriter
implementation.- See Also:
AbstractModelWriter
-
-
Constructor Summary
Constructors Constructor Description GenericModelWriter(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
writeUTF(String s)
Writes aString
to the underlyingDataOutputStream
.
-
-
-
Constructor Detail
-
GenericModelWriter
public GenericModelWriter(AbstractModel model, File file) throws IOException
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
public GenericModelWriter(AbstractModel model, DataOutputStream dos)
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 Detail
-
close
public void close() throws IOException
Description copied from class:AbstractModelWriter
Closes the underlyingDataOutputStream
.- Specified by:
close
in classAbstractModelWriter
- Throws:
IOException
- Thrown if IO errors occurred.
-
persist
public void persist() throws IOException
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
public void writeDouble(double d) throws IOException
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
public void writeInt(int i) throws IOException
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
public void writeUTF(String s) throws IOException
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.
-
-