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.
Constructor and Description |
---|
CloseShieldInputStream(java.io.InputStream inputStream)
Deprecated.
Using this constructor prevents IDEs from warning if the
underlying input stream is never closed. Use
wrap(InputStream) instead. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Replaces the underlying input stream with a
ClosedInputStream
sentinel. |
static CloseShieldInputStream |
wrap(java.io.InputStream inputStream)
Creates a proxy that shields the given input stream from being closed.
|
available, mark, markSupported, read, read, read, reset, skip
@Deprecated public CloseShieldInputStream(java.io.InputStream inputStream)
wrap(InputStream)
instead.inputStream
- underlying input streampublic static CloseShieldInputStream wrap(java.io.InputStream inputStream)
inputStream
- the input stream to wrappublic void close()
ClosedInputStream
sentinel. The original input stream will remain open, but this proxy will
appear closed.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ProxyInputStream
Copyright © 2010 - 2023 Adobe. All Rights Reserved