Package opennlp.tools.ml.model
Class BinaryFileDataReader
- java.lang.Object
-
- opennlp.tools.ml.model.BinaryFileDataReader
-
- All Implemented Interfaces:
DataReader
public class BinaryFileDataReader extends Object implements DataReader
ADataReader
that reads files from a binary format.
-
-
Constructor Summary
Constructors Constructor Description BinaryFileDataReader(DataInputStream in)
InstantiatesBinaryFileDataReader
via anDataInputStream
.BinaryFileDataReader(File f)
BinaryFileDataReader(InputStream in)
-
-
-
Constructor Detail
-
BinaryFileDataReader
public BinaryFileDataReader(File f) throws IOException
InstantiatesBinaryFileDataReader
via aFile
and creates aDataInputStream
for it. Based on whether the file's suffix contains.gz
, it detects whether the file is gzipped or not.- Parameters:
f
- TheFile
that references the model to be read.- Throws:
IOException
-
BinaryFileDataReader
public BinaryFileDataReader(InputStream in)
- Parameters:
in
- TheInputStream
that references the model to be read.
-
BinaryFileDataReader
public BinaryFileDataReader(DataInputStream in)
InstantiatesBinaryFileDataReader
via anDataInputStream
.- Parameters:
in
- TheDataInputStream
that references the model to be read.
-
-
Method Detail
-
readDouble
public double readDouble() throws IOException
- Specified by:
readDouble
in interfaceDataReader
- Returns:
- Reads and returns a
double
value. - Throws:
IOException
- Thrown if IO errors occurred during read operation.
-
readInt
public int readInt() throws IOException
- Specified by:
readInt
in interfaceDataReader
- Returns:
- Reads and returns an
int
value. - Throws:
IOException
- Thrown if IO errors occurred during read operation.
-
readUTF
public String readUTF() throws IOException
- Specified by:
readUTF
in interfaceDataReader
- Returns:
- Reads and returns
UTF-encoded characters
. - Throws:
IOException
- Thrown if IO errors occurred during read operation.
-
-