public class ClosedWriter extends Writer
close() implemented as a noop.
Typically uses of this class include testing for corner cases in methods that accept a writer and acting as a
sentinel value instead of a null writer.
| Modifier and Type | Field and Description |
|---|---|
static ClosedWriter |
CLOSED_WRITER
Deprecated.
Use
INSTANCE. |
static ClosedWriter |
INSTANCE
The singleton instance.
|
| Constructor and Description |
|---|
ClosedWriter() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush()
Throws an
IOException to indicate that the stream is closed. |
void |
write(char[] cbuf,
int off,
int len)
Throws an
IOException to indicate that the writer is closed. |
public static final ClosedWriter INSTANCE
@Deprecated public static final ClosedWriter CLOSED_WRITER
INSTANCE.public ClosedWriter()
public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic void flush() throws IOException
IOException to indicate that the stream is closed.flush in interface Flushableflush in class WriterIOException - always thrownpublic void write(char[] cbuf, int off, int len) throws IOException
IOException to indicate that the writer is closed.write in class Writercbuf - ignoredoff - ignoredlen - ignoredIOException - always thrownCopyright © 2002–2023 The Apache Software Foundation. All rights reserved.