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
A `DataReader` that reads files from a binary format.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BinaryFileDataReader(DataInputStream in)`
  Instantiates `BinaryFileDataReader` via an `DataInputStream`.
  `BinaryFileDataReader(File f)`
  Instantiates `BinaryFileDataReader` via a `File` and creates a `DataInputStream` for it.
  `BinaryFileDataReader(InputStream in)`
  Instantiates `BinaryFileDataReader` via an `InputStream` and creates a `DataInputStream` for it.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `readDouble()`
  `int`
  `readInt()`
  `String`
  `readUTF()`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BinaryFileDataReader

    public BinaryFileDataReader(File f) throws IOException
    Instantiates `BinaryFileDataReader` via a `File` and creates a `DataInputStream` for it. Based on whether the file's suffix contains `.gz`, it detects whether the file is gzipped or not.
    Parameters:
      `f` - The `File` that references the model to be read.
    Throws:
      `IOException`

  - ### BinaryFileDataReader

    public BinaryFileDataReader(InputStream in)
    Instantiates `BinaryFileDataReader` via an `InputStream` and creates a `DataInputStream` for it.
    Parameters:
      `in` - The `InputStream` that references the model to be read.

  - ### BinaryFileDataReader

    public BinaryFileDataReader(DataInputStream in)
    Instantiates `BinaryFileDataReader` via an `DataInputStream`.
    Parameters:
      `in` - The `DataInputStream` that references the model to be read.

- ## Method Details

  - ### readDouble

    public double readDouble() throws IOException
    Specified by:
      `readDouble` in interface `DataReader`
    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 interface `DataReader`
    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 interface `DataReader`
    Returns:
      Reads and returns `UTF-encoded characters`.
    Throws:
      `IOException` - Thrown if IO errors occurred during read operation.