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 genericAbstractModelWriterimplementation.- See Also:
AbstractModelWriter
-
-
Constructor Summary
Constructors Constructor Description GenericModelWriter(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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.voidwriteUTF(String s)Writes aStringto the underlyingDataOutputStream.
-
-
-
Constructor Detail
-
GenericModelWriter
public GenericModelWriter(AbstractModel model, File file) throws IOException
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
public GenericModelWriter(AbstractModel model, DataOutputStream dos)
Initializes aGenericModelWriterfor anAbstractModelwith an associatedDataOutputStreamthe model shall be written to.- Parameters:
model- Themodelto write out.dos- TheDataOutputStreamthat used to be written to.
-
-
Method Detail
-
close
public void close() throws IOExceptionDescription copied from class:AbstractModelWriterCloses the underlyingDataOutputStream.- Specified by:
closein classAbstractModelWriter- Throws:
IOException- Thrown if IO errors occurred.
-
persist
public void persist() throws IOExceptionDescription 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
public void writeDouble(double d) throws IOExceptionDescription copied from class:AbstractModelWriterWrites a singledoubleto the underlyingDataOutputStream.- Specified by:
writeDoublein classAbstractModelWriter- Parameters:
d- Thedoublevalue.- Throws:
IOException- Thrown if IO errors occurred.
-
writeInt
public void writeInt(int i) throws IOExceptionDescription copied from class:AbstractModelWriterWrites a singleintto the underlyingDataOutputStream.- Specified by:
writeIntin classAbstractModelWriter- Parameters:
i- Theintvalue.- Throws:
IOException- Thrown if IO errors occurred.
-
writeUTF
public void writeUTF(String s) throws IOException
Description copied from class:AbstractModelWriterWrites aStringto the underlyingDataOutputStream.- Specified by:
writeUTFin classAbstractModelWriter- Parameters:
s- TheUTF encodedcharacters.- Throws:
IOException- Thrown if IO errors occurred.
-
-