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
ConstructorsConstructorDescriptionGenericModelWriter(AbstractModel model, DataOutputStream dos) Initializes aGenericModelWriterfor anAbstractModelwith an associatedDataOutputStreamthe model shall be written to.GenericModelWriter(AbstractModel model, File file) Initializes aGenericModelWriterfor anAbstractModelwith an associatedFilethe model shall be written to. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlyingDataOutputStream.voidpersist()Serializes themodelusing theAbstractModelWriter.writeUTF(String),AbstractModelWriter.writeDouble(double), orAbstractModelWriter.writeInt(int)} methods implemented by extending classes.voidwriteDouble(double d) Writes a singledoubleto the underlyingDataOutputStream.voidwriteInt(int i) Writes a singleintto the underlyingDataOutputStream.voidWrites aStringto the underlyingDataOutputStream.
-
Constructor Details
-
GenericModelWriter
Initializes aGenericModelWriterfor anAbstractModelwith an associatedFilethe model shall be written to.- Parameters:
model- Themodelto write out.file- TheFilethat used to be written to.- Throws:
IOException- Thrown if IO errors occurred.
-
GenericModelWriter
Initializes aGenericModelWriterfor anAbstractModelwith an associatedDataOutputStreamthe model shall be written to.- Parameters:
model- Themodelto write out.dos- TheDataOutputStreamthat used to be written to.
-
-
Method Details
-
close
Description copied from class:AbstractModelWriterCloses the underlyingDataOutputStream.- Specified by:
closein classAbstractModelWriter- Throws:
IOException- Thrown if IO errors occurred.
-
persist
Description copied from class:AbstractModelWriterSerializes themodelusing theAbstractModelWriter.writeUTF(String),AbstractModelWriter.writeDouble(double), orAbstractModelWriter.writeInt(int)} methods implemented by extending classes.- Specified by:
persistin classAbstractModelWriter- Throws:
IOException- Thrown if IO errors occurred.
-
writeDouble
Description copied from class:AbstractModelWriterWrites a singledoubleto the underlyingDataOutputStream.- Specified by:
writeDoublein classAbstractModelWriter- Parameters:
d- Thedoublevalue.- Throws:
IOException- Thrown if IO errors occurred.
-
writeInt
Description copied from class:AbstractModelWriterWrites a singleintto the underlyingDataOutputStream.- Specified by:
writeIntin classAbstractModelWriter- Parameters:
i- Theintvalue.- Throws:
IOException- Thrown if IO errors occurred.
-
writeUTF
Description copied from class:AbstractModelWriterWrites aStringto the underlyingDataOutputStream.- Specified by:
writeUTFin classAbstractModelWriter- Parameters:
s- TheUTF encodedcharacters.- Throws:
IOException- Thrown if IO errors occurred.
-