Class NullOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.logging.log4j.core.util.NullOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
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
Fields Modifier and Type Field Description static NullOutputStreamNULL_OUTPUT_STREAMDeprecated.Deprecated in 2.7: usegetInstance().
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NullOutputStreamgetInstance()Gets the singleton instance.voidwrite(byte[] b)Does nothing - output to/dev/null.voidwrite(byte[] b, int off, int len)Does nothing - output to/dev/null.voidwrite(int b)Does nothing - output to/dev/null.-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
-
-
-
Field Detail
-
NULL_OUTPUT_STREAM
@Deprecated public static final NullOutputStream NULL_OUTPUT_STREAM
Deprecated.Deprecated in 2.7: usegetInstance().
-
-
Method Detail
-
getInstance
public static NullOutputStream getInstance()
Gets the singleton instance.- Returns:
- the singleton instance.
-
write
public void write(byte[] b, int off, int len)Does nothing - output to/dev/null.- Overrides:
writein classOutputStream- Parameters:
b- The bytes to writeoff- The start offsetlen- The number of bytes to write
-
write
public void write(int b)
Does nothing - output to/dev/null.- Specified by:
writein classOutputStream- Parameters:
b- The byte to write
-
write
public void write(byte[] b) throws IOExceptionDoes nothing - output to/dev/null.- Overrides:
writein classOutputStream- Parameters:
b- The bytes to write- Throws:
IOException- never
-
-