RealValueFileEventStream (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.ml.model

## Class RealValueFileEventStream

- java.lang.Object
- - opennlp.tools.ml.model.FileEventStream
  - - opennlp.tools.ml.model.RealValueFileEventStream

- All Implemented Interfaces:
    AutoCloseable, ObjectStream<Event>

      public class RealValueFileEventStream
      extends FileEventStream

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RealValueFileEventStream(File file)`
    `RealValueFileEventStream(String fileName)`
    `RealValueFileEventStream(String fileName, String encoding)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static float[]` | `parseContexts(String[] contexts)` Parses the specified contexts and re-populates context array with features and returns the values for these features.
    `Event` | `read()` Returns the next object.

    - ### Methods inherited from class opennlp.tools.ml.model.FileEventStream

      `close, reset, toLine`

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

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

- - ### Constructor Detail

    - #### RealValueFileEventStream

          public RealValueFileEventStream(String fileName)
                                   throws IOException

      Throws:
        `IOException`

    - #### RealValueFileEventStream

          public RealValueFileEventStream(String fileName,
                                          String encoding)
                                   throws IOException

      Throws:
        `IOException`

    - #### RealValueFileEventStream

          public RealValueFileEventStream(File file)
                                   throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### parseContexts

          public static float[] parseContexts(String[] contexts)

      Parses the specified contexts and re-populates context array with features and returns the values for these features. If all values are unspecified, then null is returned.
      Parameters:
        `contexts` - The contexts with real values specified.
      Returns:
        The value for each context or null if all values are unspecified.

    - #### read

          public Event read()
                     throws IOException

      Description copied from interface: `ObjectStream`
      Returns the next object. Calling this method repeatedly until it returns null will return each object from the underlying source exactly once.
      Specified by:
        `read` in interface `ObjectStream<Event>`
      Overrides:
        `read` in class `FileEventStream`
      Returns:
        the next object or null to signal that the stream is exhausted
      Throws:
        `IOException` - if there is an error during reading

Copyright © 2026 The Apache Software Foundation. All rights reserved.