public class CloseShieldReader extends ProxyReader
This class is typically used in cases where a reader needs to be passed to a component that wants to explicitly close the reader even if more input would still be available to other components.
Constructor and Description |
---|
CloseShieldReader(java.io.Reader reader)
Deprecated.
Using this constructor prevents IDEs from warning if the
underlying reader is never closed. Use
wrap(Reader)
instead. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Replaces the underlying reader with a
ClosedReader sentinel. |
static CloseShieldReader |
wrap(java.io.Reader reader)
Creates a proxy that shields the given reader from being closed.
|
mark, markSupported, read, read, read, read, ready, reset, skip
@Deprecated public CloseShieldReader(java.io.Reader reader)
wrap(Reader)
instead.reader
- underlying readerpublic static CloseShieldReader wrap(java.io.Reader reader)
reader
- the reader to wrappublic void close()
ClosedReader
sentinel. The
original reader will remain open, but this proxy will appear closed.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ProxyReader
Copyright © 2010 - 2023 Adobe. All Rights Reserved