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
A singleton.
|
| 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 CLOSED_WRITER
public ClosedWriter()
public 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 thrownpublic void flush() throws IOException
IOException to indicate that the stream is closed.flush in interface Flushableflush in class WriterIOException - always thrownpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.