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
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 void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
IOException
to indicate that the stream is closed.flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
- always thrownpublic 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.Writer
cbuf
- ignoredoff
- ignoredlen
- ignoredjava.io.IOException
- always thrownCopyright © 2010 - 2023 Adobe. All Rights Reserved