LineOrientedOutputStreamRedirector (Apache Ant API)
Date: 2018-07-10

org.apache.tools.ant.util

## Class LineOrientedOutputStreamRedirector

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.tools.ant.util.LineOrientedOutputStream
    - - org.apache.tools.ant.util.LineOrientedOutputStreamRedirector

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

      public class LineOrientedOutputStreamRedirector
      extends LineOrientedOutputStream

  Output stream which buffer and redirect a stream line by line.

  If the source stream doesn't end with a end of line, one will be added. This is particularly useful in combination with the OutputStreamFunneler so each funneled stream get its line.

  Since:
    Ant 1.8.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LineOrientedOutputStreamRedirector(java.io.OutputStream stream)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Writes all remaining
    `void` | `flush()` Flush this log stream
    `protected void` | `processLine(byte[] b)` Processes a line.
    `protected void` | `processLine(java.lang.String line)` Processes a line.

    - ### Methods inherited from class org.apache.tools.ant.util.LineOrientedOutputStream

      `processBuffer, write, write`

    - ### Methods inherited from class java.io.OutputStream

      `write`

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

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

- - ### Constructor Detail

    - #### LineOrientedOutputStreamRedirector

          public LineOrientedOutputStreamRedirector(java.io.OutputStream stream)

  - ### Method Detail

    - #### processLine

          protected void processLine(byte[] b)
                              throws java.io.IOException

      Description copied from class: `LineOrientedOutputStream`
      Processes a line.

      This implementations invokes the string-arg version converting the byte array using the default encoding. Subclasses are encouraged to override this method (and provide a dummy implementation of the String-arg version) so they don't interfere with the encoding of the underlying stream.

      Overrides:
        `processLine` in class `LineOrientedOutputStream`
      Parameters:
        `b` - the line to log.
      Throws:
        `java.io.IOException` - if there is an error.

    - #### processLine

          protected void processLine(java.lang.String line)
                              throws java.io.IOException

      Description copied from class: `LineOrientedOutputStream`
      Processes a line.
      Specified by:
        `processLine` in class `LineOrientedOutputStream`
      Parameters:
        `line` - the line to log.
      Throws:
        `java.io.IOException` - if there is an error.

    - #### close

          public void close()
                     throws java.io.IOException

      Description copied from class: `LineOrientedOutputStream`
      Writes all remaining
      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `LineOrientedOutputStream`
      Throws:
        `java.io.IOException` - if there is an error.

    - #### flush

          public void flush()
                     throws java.io.IOException

      Description copied from class: `LineOrientedOutputStream`
      Flush this log stream
      Specified by:
        `flush` in interface `java.io.Flushable`
      Overrides:
        `flush` in class `LineOrientedOutputStream`
      Throws:
        `java.io.IOException` - if there is an error.