FileStreams (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.topology.file

## Class FileStreams

- java.lang.Object
- - com.ibm.streamsx.topology.file.FileStreams

-     public class FileStreams
      extends java.lang.Object

  Utilities for file system related streams.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileStreams()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TStream<java.lang.String>` | `directoryWatcher(TopologyElement te, java.lang.String directory)` Creates a stream of absolute newly created file names from watching `directory`.
    `static TStream<java.lang.String>` | `suffixFilter(TStream<java.lang.String> fileNames, java.lang.String... suffixes)` Filter a `Stream<String>` containing file names by suffix values.
    `static TStream<java.lang.String>` | `textFileReader(TStream<java.lang.String> input)` Returns a Stream that reads each file named on its input stream, outputting a tuple for each line read.

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

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

- - ### Constructor Detail

    - #### FileStreams

          public FileStreams()

  - ### Method Detail

    - #### directoryWatcher

          public static TStream<java.lang.String> directoryWatcher(TopologyElement te,
                                                                   java.lang.String directory)

      Creates a stream of absolute newly created file names from watching `directory`.
      Parameters:
        `directory` - Name of the directory to watch.
      Returns:
        A stream that will contain newly created files in `directory`.

    - #### suffixFilter

          public static TStream<java.lang.String> suffixFilter(TStream<java.lang.String> fileNames,
                                                               java.lang.String... suffixes)

      Filter a `Stream<String>` containing file names by suffix values. If a file name on `fileNames` ends with a suffix in `suffixes` preceded by a dot `'.'`.
      Parameters:
        `fileNames` - Input stream that will contain file names.
        `suffixes` - Suffixes to filter for.
      Returns:
        Stream that will contain file names with suffixes in `suffixes`.

    - #### textFileReader

          public static TStream<java.lang.String> textFileReader(TStream<java.lang.String> input)

      Returns a Stream that reads each file named on its input stream, outputting a tuple for each line read. All files are assumed to be encoded using UTF-8. The lines are output in the order they appear in each file, with the first line of a file appearing first.
      Parameters:
        `input` - Stream containing files to read.
      Returns:
        Stream contains lines from input files.