public class ClosedWriter
extends java.io.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 void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
IOException to indicate that the writer is closed.write in class java.io.Writercbuf - ignoredoff - ignoredlen - ignoredjava.io.IOException - always thrownpublic void flush()
throws java.io.IOException
IOException to indicate that the stream is closed.flush in interface java.io.Flushableflush in class java.io.Writerjava.io.IOException - always thrownpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Writerjava.io.IOException