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 void write(char[] cbuf, int off, int len) throws IOException
IOException
to indicate that the writer is closed.write
in class Writer
cbuf
- ignoredoff
- ignoredlen
- ignoredIOException
- always thrownpublic void flush() throws IOException
IOException
to indicate that the stream is closed.flush
in interface Flushable
flush
in class Writer
IOException
- always thrownpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
Jas4pp 1.5 © Java Analysis Studio for Particle Physics