org.apache.tools.ant.util
Class KeepAliveInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.apache.tools.ant.util.KeepAliveInputStream
All Implemented Interfaces:
java.io.Closeable

public class KeepAliveInputStream
extends java.io.FilterInputStream

Class that can be used to wrap System.in without getting anxious about any client closing the stream.

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

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

Since:
Ant 1.6

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
KeepAliveInputStream(java.io.InputStream in)
          Constructor of KeepAliveInputStream.
 
Method Summary
 void close()
          This method does nothing.
static java.io.InputStream wrapSystemIn()
          Convenience factory method that returns a non-closing InputStream around System.in.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeepAliveInputStream

public KeepAliveInputStream(java.io.InputStream in)
Constructor of KeepAliveInputStream.

Parameters:
in - an InputStream value, it should be standard input.
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.FilterInputStream
Throws:
java.io.IOException - as we are overriding FilterInputStream.

wrapSystemIn

public static java.io.InputStream wrapSystemIn()
Convenience factory method that returns a non-closing InputStream around System.in.

Since:
Ant 1.8.0