org.apache.tools.ant.util

Class KeepAliveOutputStream

public class KeepAliveOutputStream extends 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();
 }
 

Constructor Summary
KeepAliveOutputStream(OutputStream out)
Constructor of KeepAliveOutputStream.
Method Summary
voidclose()
This method does nothing.
static PrintStreamwrapSystemErr()
Convenience factory method that returns a non-closing PrintStream around System.err.
static PrintStreamwrapSystemOut()
Convenience factory method that returns a non-closing PrintStream around System.out.

Constructor Detail

KeepAliveOutputStream

public KeepAliveOutputStream(OutputStream out)
Constructor of KeepAliveOutputStream.

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

Method Detail

close

public void close()
This method does nothing.

Throws: IOException as we are overridding FilterOutputStream.

wrapSystemErr

public static PrintStream wrapSystemErr()
Convenience factory method that returns a non-closing PrintStream around System.err.

Since: Ant 1.8.0

wrapSystemOut

public static PrintStream wrapSystemOut()
Convenience factory method that returns a non-closing PrintStream around System.out.

Since: Ant 1.8.0