public class NullOutputStream
extends java.io.OutputStream
"dev/null"
output stream - an output stream implementation that discards all the
data written to it. This implementation is not thread-safe.
Note that once a null output stream instance is closed
, any subsequent attempts
to write the data to the closed stream result in an IOException
being thrown.Modifier and Type | Field and Description |
---|---|
private boolean |
isClosed |
Constructor and Description |
---|
NullOutputStream() |
Modifier and Type | Method and Description |
---|---|
private void |
checkClosed() |
void |
close() |
void |
flush() |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
private void checkClosed() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException