org.apache.logging.log4j.core.util
Class NullOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.logging.log4j.core.util.NullOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class NullOutputStream
extends OutputStream

Writes all data to the famous /dev/null.

This output stream has no destination (file/socket etc.) and all bytes written to it are ignored and lost.

Originally from Apache Commons IO.

Since:
2.3

Field Summary
static NullOutputStream NULL_OUTPUT_STREAM
          A singleton.
 
Constructor Summary
NullOutputStream()
           
 
Method Summary
 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.
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_OUTPUT_STREAM

public static final NullOutputStream NULL_OUTPUT_STREAM
A singleton.

Constructor Detail

NullOutputStream

public NullOutputStream()
Method Detail

write

public void write(byte[] b,
                  int off,
                  int len)
Does nothing - output to /dev/null.

Overrides:
write in class OutputStream
Parameters:
b - The bytes to write
off - The start offset
len - The number of bytes to write

write

public void write(int b)
Does nothing - output to /dev/null.

Specified by:
write in class OutputStream
Parameters:
b - The byte to write

write

public void write(byte[] b)
           throws IOException
Does nothing - output to /dev/null.

Overrides:
write in class OutputStream
Parameters:
b - The bytes to write
Throws:
IOException - never


Copyright © 1999-2015 Apache Software Foundation. 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.