Closeable
, Flushable
, AutoCloseable
public class NullOutputStream extends OutputStream
This output stream has no destination (file/socket etc.) and all bytes written to it are ignored and lost.
Originally from Apache Commons IO.Modifier and Type | Field | Description |
---|---|---|
static NullOutputStream |
NULL_OUTPUT_STREAM |
Deprecated.
Deprecated in 2.7: use
getInstance() . |
Modifier and Type | Method | Description |
---|---|---|
static NullOutputStream |
getInstance() |
Gets the singleton instance.
|
void |
write(byte[] b) |
Does nothing - output to
/dev/null . |
void |
write(byte[] b,
int off,
int len) |
Does nothing - output to
/dev/null . |
void |
write(int b) |
Does nothing - output to
/dev/null . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, flush
@Deprecated public static final NullOutputStream NULL_OUTPUT_STREAM
getInstance()
.public static NullOutputStream getInstance()
public void write(byte[] b, int off, int len)
/dev/null
.write
in class OutputStream
b
- The bytes to writeoff
- The start offsetlen
- The number of bytes to writepublic void write(int b)
/dev/null
.write
in class OutputStream
b
- The byte to writepublic void write(byte[] b) throws IOException
/dev/null
.write
in class OutputStream
b
- The bytes to writeIOException
- neverCopyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.