Package opennlp.tools.util.model
Class ByteArraySerializer
- java.lang.Object
-
- opennlp.tools.util.model.ByteArraySerializer
-
- All Implemented Interfaces:
ArtifactSerializer<byte[]>
public class ByteArraySerializer extends Object implements ArtifactSerializer<byte[]>
AnArtifactSerializer
implementation for binary data, kept inbyte[]
.
-
-
Constructor Summary
Constructors Constructor Description ByteArraySerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
create(InputStream in)
Creates an artifact from the providedInputStream
.void
serialize(byte[] artifact, OutputStream out)
Serializes an artifact to the providedOutputStream
.
-
-
-
Method Detail
-
create
public byte[] 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<byte[]>
- 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(byte[] 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<byte[]>
- Parameters:
artifact
- A validartifact
.out
- A valid, openOutputStream
ready to write to.- Throws:
IOException
- Thrown if IO errors occurred during serialization.
-
-