public class CloseShieldInputStream extends ProxyInputStream
This class is typically used in cases where an input stream needs to be passed to a component that wants to explicitly close the stream even if more input would still be available to other components.
ProxyInputStream.AbstractBuilder<T,B extends AbstractStreamBuilder<T,B>>in| Modifier and Type | Method and Description |
|---|---|
void |
close()
Replaces the underlying input stream with a
ClosedInputStream
sentinel. |
static InputStream |
systemIn(InputStream inputStream)
Constructs a proxy that only shields
System.in from closing. |
static CloseShieldInputStream |
wrap(InputStream inputStream)
Constructs a proxy that shields the given input stream from being closed.
|
afterRead, available, beforeRead, checkOpen, handleIOException, isClosed, mark, markSupported, read, read, read, reset, setReference, skip, unwrappublic void close()
ClosedInputStream
sentinel. The original input stream will remain open, but this proxy will
appear closed.close in interface Closeableclose in interface AutoCloseableclose in class ProxyInputStreampublic static InputStream systemIn(InputStream inputStream)
System.in from closing.inputStream - the candidate input stream.System.in.public static CloseShieldInputStream wrap(InputStream inputStream)
inputStream - the input stream to wrap