Top Description Fields Constructors Methods
org.apache.tools.ant.util

public Class KeepAliveOutputStream

extends FilterOutputStream
Class Inheritance
Imports
java.io.FilterOutputStream, .IOException, .OutputStream, .PrintStream

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

Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
KeepAliveOutputStream(OutputStream
an OutputStream value, it should be standard output.
out
)

Constructor of KeepAliveOutputStream.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

This method does nothing.
private static PrintStream

Returns:

PrintStream
wrap
(PrintStream ps)

public static PrintStream

Returns:

PrintStream
wrapSystemErr
()

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

public static PrintStream

Returns:

PrintStream
wrapSystemOut
()

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

Inherited from java.io.FilterOutputStream:
flushwritewritewrite

Constructor Detail

KeepAliveOutputStreamback to summary
public KeepAliveOutputStream(OutputStream out)

Constructor of KeepAliveOutputStream.

Parameters
out:OutputStream

an OutputStream value, it should be standard output.

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

This method does nothing.

Exceptions
IOException:
as we are overriding FilterOutputStream.
wrapback to summary
private static PrintStream wrap(PrintStream ps)
Returns:PrintStream

PrintStream

Since
Ant 1.8.0
wrapSystemErrback to summary
public static PrintStream wrapSystemErr()

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

Returns:PrintStream

PrintStream

Since
Ant 1.8.0
wrapSystemOutback to summary
public static PrintStream wrapSystemOut()

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

Returns:PrintStream

PrintStream

Since
Ant 1.8.0