Class KeepAliveInputStream

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

public class KeepAliveInputStream extends 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
  • Constructor Details

    • KeepAliveInputStream

      public KeepAliveInputStream(InputStream in)
      Constructor of KeepAliveInputStream.
      Parameters:
      in - an InputStream value, it should be standard input.
  • Method Details

    • close

      public void close() throws IOException
      This method does nothing.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class FilterInputStream
      Throws:
      IOException - as we are overriding FilterInputStream.
    • wrapSystemIn

      public static InputStream wrapSystemIn()
      Convenience factory method that returns a non-closing InputStream around System.in.
      Returns:
      InputStream
      Since:
      Ant 1.8.0