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
ADataReaderthat reads files from a binary format.
-
-
Constructor Summary
Constructors Constructor Description BinaryFileDataReader(DataInputStream in)InstantiatesBinaryFileDataReadervia anDataInputStream.BinaryFileDataReader(File f)BinaryFileDataReader(InputStream in)
-
-
-
Constructor Detail
-
BinaryFileDataReader
public BinaryFileDataReader(File f) throws IOException
InstantiatesBinaryFileDataReadervia aFileand creates aDataInputStreamfor it. Based on whether the file's suffix contains.gz, it detects whether the file is gzipped or not.- Parameters:
f- TheFilethat references the model to be read.- Throws:
IOException
-
BinaryFileDataReader
public BinaryFileDataReader(InputStream in)
- Parameters:
in- TheInputStreamthat references the model to be read.
-
BinaryFileDataReader
public BinaryFileDataReader(DataInputStream in)
InstantiatesBinaryFileDataReadervia anDataInputStream.- Parameters:
in- TheDataInputStreamthat references the model to be read.
-
-
Method Detail
-
readDouble
public double readDouble() throws IOException- Specified by:
readDoublein interfaceDataReader- Returns:
- Reads and returns a
doublevalue. - Throws:
IOException- Thrown if IO errors occurred during read operation.
-
readInt
public int readInt() throws IOException- Specified by:
readIntin interfaceDataReader- Returns:
- Reads and returns an
intvalue. - Throws:
IOException- Thrown if IO errors occurred during read operation.
-
readUTF
public String readUTF() throws IOException
- Specified by:
readUTFin interfaceDataReader- Returns:
- Reads and returns
UTF-encoded characters. - Throws:
IOException- Thrown if IO errors occurred during read operation.
-
-