KeepAliveOutputStream (Apache Ant API)
Date: 2012-02-26

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.util
Class KeepAliveOutputStream

    java.lang.Object
      java.io.OutputStream
          java.io.FilterOutputStream
              org.apache.tools.ant.util.KeepAliveOutputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable

    public class KeepAliveOutputStream

extends java.io.FilterOutputStream

Class that can be used to wrap `System.out` and `System.err` without getting anxious about any client closing the stream.

In code-language it means that it is not necessary to do:

     if (out != System.out && out!= System.err) {
       out.close();
     }

Field Summary

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`KeepAliveOutputStream(java.io.OutputStream out)` Constructor of KeepAliveOutputStream.

Method Summary
`void` | `close()` This method does nothing.
`static java.io.PrintStream` | `wrapSystemErr()` Convenience factory method that returns a non-closing PrintStream around System.err.
`static java.io.PrintStream` | `wrapSystemOut()` Convenience factory method that returns a non-closing PrintStream around System.out.

Methods inherited from class java.io.FilterOutputStream
`flush, write, write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KeepAliveOutputStream

    public KeepAliveOutputStream(java.io.OutputStream out)

  Constructor of KeepAliveOutputStream.

  Parameters:
    `out` - an OutputStream value, it shoudl be standard output.

Method Detail

### close

    public void close()
               throws java.io.IOException

  This method does nothing.

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException` - as we are overridding FilterOutputStream.

### wrapSystemOut

    public static java.io.PrintStream wrapSystemOut()

  Convenience factory method that returns a non-closing PrintStream around System.out.

  Since:
    Ant 1.8.0

### wrapSystemErr

    public static java.io.PrintStream wrapSystemErr()

  Convenience factory method that returns a non-closing PrintStream around System.err.

  Since:
    Ant 1.8.0

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD