MascTokenSampleStream (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.formats.masc, class: MascTokenSampleStream

# Class MascTokenSampleStream

java.lang.Object
opennlp.tools.util.FilterObjectStream<MascDocument, TokenSample>
opennlp.tools.formats.masc.MascTokenSampleStream

All Implemented Interfaces:
  `AutoCloseable, ObjectStream<TokenSample>`

public class MascTokenSampleStream extends FilterObjectStream<MascDocument, TokenSample>

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MascTokenSampleStream(ObjectStream<MascDocument> samples)`
  Initializes a `MascTokenSampleStream`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TokenSample`
  `read()`
  Returns the next `T` object.
  `void`
  `reset()`
  Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.

  ### Methods inherited from class FilterObjectStream

  `close`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### MascTokenSampleStream

    public MascTokenSampleStream(ObjectStream<MascDocument> samples) throws IOException
    Initializes a `MascTokenSampleStream`.
    Parameters:
      `samples` - The `ObjectStream<MascDocument>` samples to process.
    Throws:
      `IOException` - Thrown if non of the `documents` had Penn tokenization.

- ## Method Details

  - ### read

    public TokenSample read() throws IOException
    Description copied from interface: `ObjectStream`
    Returns the next `T` object. Calling this method repeatedly until it returns `null` will return each object from the underlying source exactly once.
    Returns:
      The next object or `null` to signal that the stream is exhausted.
    Throws:
      `IOException` - Thrown if there is an error during reading.

  - ### reset

    public void reset() throws IOException, UnsupportedOperationException
    Description copied from interface: `ObjectStream`
    Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly. This method can be used to re-read the stream if multiple passes over the objects are required.

    The implementation of this method is optional.

    Specified by:
      `reset` in interface `ObjectStream<TokenSample>`
    Overrides:
      `reset` in class `FilterObjectStream<MascDocument, TokenSample>`
    Throws:
      `IOException` - Thrown if there is an error during resetting the stream.
      `UnsupportedOperationException` - Thrown if the `reset()` is not supported. By default, this is the case.