Package opennlp.tools.util.model
Class GenericModelSerializer
- java.lang.Object
-
- opennlp.tools.util.model.GenericModelSerializer
-
- All Implemented Interfaces:
ArtifactSerializer<AbstractModel>
public class GenericModelSerializer extends Object implements ArtifactSerializer<AbstractModel>
AnArtifactSerializer
implementation formodels
.
-
-
Constructor Summary
Constructors Constructor Description GenericModelSerializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractModel
create(InputStream in)
Creates an artifact from the providedInputStream
.static void
register(Map<String,ArtifactSerializer<?>> factories)
Registers a newGenericModelSerializer
in the givenfactories
mapping.void
serialize(AbstractModel artifact, OutputStream out)
Serializes an artifact to the providedOutputStream
.
-
-
-
Method Detail
-
create
public AbstractModel create(InputStream in) throws IOException
Description copied from interface:ArtifactSerializer
Creates an artifact from the providedInputStream
.Note: The
InputStream
remains open.- Specified by:
create
in interfaceArtifactSerializer<AbstractModel>
- Parameters:
in
- A valid, openInputStream
ready to read from.- Returns:
- A valid
artifact
. - Throws:
IOException
- Thrown if IO errors occurred during creation.
-
serialize
public void serialize(AbstractModel artifact, OutputStream out) throws IOException
Description copied from interface:ArtifactSerializer
Serializes an artifact to the providedOutputStream
.Note: The
OutputStream
remains open.- Specified by:
serialize
in interfaceArtifactSerializer<AbstractModel>
- Parameters:
artifact
- A validartifact
.out
- A valid, openOutputStream
ready to write to.- Throws:
IOException
- Thrown if IO errors occurred during serialization.
-
register
public static void register(Map<String,ArtifactSerializer<?>> factories)
Registers a newGenericModelSerializer
in the givenfactories
mapping.- Parameters:
factories
- AMap
holdingArtifactSerializer
for re-use.
-
-