public class ClosedOutputStream extends OutputStream
Typically uses of this class include testing for corner cases in methods that accept an output stream and acting as a sentinel value instead of a
null output stream.
| Modifier and Type | Field and Description |
|---|---|
static ClosedOutputStream |
INSTANCE
The singleton instance.
|
| Constructor and Description |
|---|
ClosedOutputStream()
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Throws an
IOException to indicate that the stream is closed. |
void |
write(byte[] b,
int off,
int len)
Throws an
IOException to indicate that the stream is closed. |
void |
write(int b)
Throws an
IOException to indicate that the stream is closed. |
close, writepublic static final ClosedOutputStream INSTANCE
public void flush()
throws IOException
IOException to indicate that the stream is closed.flush in interface Flushableflush in class OutputStreamIOException - always thrownpublic void write(byte[] b,
int off,
int len)
throws IOException
IOException to indicate that the stream is closed.write in class OutputStreamb - ignoredoff - ignoredlen - ignoredIOException - always thrownpublic void write(int b)
throws IOException
IOException to indicate that the stream is closed.write in class OutputStreamb - ignoredIOException - always thrown