org.apache.tools.ant.utilClass KeepAliveInputStream
- java.lang.Object
- java.io.InputStream
- java.io.FilterInputStream
- org.apache.tools.ant.util.KeepAliveInputStream
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable
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
Constructor Summary
Constructors Constructor and Description KeepAliveInputStream(java.io.InputStream in)
Constructor of KeepAliveInputStream.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
close()
This method does nothing.static java.io.InputStream
wrapSystemIn()
Convenience factory method that returns a non-closing InputStream around System.in.
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.IOExceptionThis method does nothing.
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Overrides:
close
in classjava.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.
- Returns:
- InputStream
- Since:
- Ant 1.8.0