LineOrientedOutputStreamRedirector (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.util, class: LineOrientedOutputStreamRedirector

# Class LineOrientedOutputStreamRedirector

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

All Implemented Interfaces:
  `Closeable, Flushable, 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
  Description
  `LineOrientedOutputStreamRedirector(OutputStream stream)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Writes all remaining
  `void`
  `flush()`
  Flush this log stream
  `protected void`
  `processLine(byte[] b)`
  Processes a line.
  `protected void`
  `processLine(String line)`
  Processes a line.

  ### Methods inherited from class LineOrientedOutputStream

  `processBuffer, write, write`
  Modifier and Type
  Method
  Description
  `protected void`
  `processBuffer()`
  Converts the buffer to a byte[] and sends it to `processLine`
  `final void`
  `write(byte[] b, int off, int len)`
  Write a block of characters to the output stream
  `final void`
  `write(int cc)`
  Write the data to the buffer and flush the buffer, if a line separator is detected.

  ### Methods inherited from class OutputStream

  `nullOutputStream, write`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### LineOrientedOutputStreamRedirector

    public LineOrientedOutputStreamRedirector(OutputStream stream)

- ## Method Details

  - ### processLine

    protected void processLine(byte[] b) throws 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:
      `IOException` - if there is an error.

  - ### processLine

    protected void processLine(String line) throws IOException
    Description copied from class: `LineOrientedOutputStream`
    Processes a line.
    Specified by:
      `processLine` in class `LineOrientedOutputStream`
    Parameters:
      `line` - the line to log.
    Throws:
      `IOException` - if there is an error.

  - ### close

    public void close() throws IOException
    Description copied from class: `LineOrientedOutputStream`
    Writes all remaining
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Overrides:
      `close` in class `LineOrientedOutputStream`
    Throws:
      `IOException` - if there is an error.

  - ### flush

    public void flush() throws IOException
    Description copied from class: `LineOrientedOutputStream`
    Flush this log stream
    Specified by:
      `flush` in interface `Flushable`
    Overrides:
      `flush` in class `LineOrientedOutputStream`
    Throws:
      `IOException` - if there is an error.