Package opennlp.tools.formats

# Class DirectorySampleStream

java.lang.Object
opennlp.tools.formats.DirectorySampleStream

All Implemented Interfaces:
  `AutoCloseable`, `opennlp.tools.util.ObjectStream<File>`

public class DirectorySampleStream extends Object implements opennlp.tools.util.ObjectStream<File>
The directory sample stream allows for creating an `opennlp.tools.util.ObjectStream<File>` from a directory listing of files.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DirectorySampleStream(File[] dirs, FileFilter fileFilter, boolean recursive)`
  Initializes a `DirectorySampleStream`.
  `DirectorySampleStream(File dir, FileFilter fileFilter, boolean recursive)`
  Initializes a `DirectorySampleStream`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Calling this function has no effect on the stream.
  `File`
  `read()`
  `void`
  `reset()`

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

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

- ## Constructor Details

  - ### DirectorySampleStream

    public DirectorySampleStream(File[] dirs, FileFilter fileFilter, boolean recursive)
    Initializes a `DirectorySampleStream`.
    Parameters:
      `dirs` - The `directories` to read.
      `fileFilter` - The `filter` to apply while enumerating files.
      `recursive` - Enables or disables recursive file listing.
    Throws:
      `IllegalArgumentException` - Thrown if one element in `dirs` is not a directory.

  - ### DirectorySampleStream

    public DirectorySampleStream(File dir, FileFilter fileFilter, boolean recursive)
    Initializes a `DirectorySampleStream`.
    Parameters:
      `dir` - The `directory` to read.
      `fileFilter` - The `filter` to apply while enumerating files.
      `recursive` - Enables or disables recursive file listing.
    Throws:
      `IllegalArgumentException` - Thrown if `dir` is not a directory.

- ## Method Details

  - ### read

    public File read() throws IOException
    Specified by:
      `read` in interface `opennlp.tools.util.ObjectStream<File>`
    Throws:
      `IOException`

  - ### reset

    public void reset()
    Specified by:
      `reset` in interface `opennlp.tools.util.ObjectStream<File>`

  - ### close

    public void close() throws IOException
    Calling this function has no effect on the stream.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `opennlp.tools.util.ObjectStream<File>`
    Throws:
      `IOException`