public class CloseShieldWriter extends ProxyWriter
This class is typically used in cases where a writer needs to be passed to a component that wants to explicitly close the writer even if other components would still use the writer for output.
Constructor and Description |
---|
CloseShieldWriter(java.io.Writer writer)
Deprecated.
Using this constructor prevents IDEs from warning if the
underlying writer is never closed. Use
wrap(Writer)
instead. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Replaces the underlying writer with a
ClosedWriter sentinel. |
static CloseShieldWriter |
wrap(java.io.Writer writer)
Creates a proxy that shields the given writer from being closed.
|
@Deprecated public CloseShieldWriter(java.io.Writer writer)
wrap(Writer)
instead.writer
- underlying writerpublic static CloseShieldWriter wrap(java.io.Writer writer)
writer
- the writer to wrappublic void close()
ClosedWriter
sentinel. The
original writer will remain open, but this proxy will appear closed.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ProxyWriter
Copyright © 2010 - 2023 Adobe. All Rights Reserved