Package org.apache.commons.io.output
Class NullOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.io.output.NullOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class NullOutputStream extends java.io.OutputStreamWrites 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.
-
-
Field Summary
Fields Modifier and Type Field Description static NullOutputStreamNULL_OUTPUT_STREAMThe singleton.
-
Constructor Summary
Constructors Constructor Description NullOutputStream()Deprecated.UseNULL_OUTPUT_STREAM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
NULL_OUTPUT_STREAM
public static final NullOutputStream NULL_OUTPUT_STREAM
The singleton.
-
-
Constructor Detail
-
NullOutputStream
@Deprecated public NullOutputStream()
Deprecated.UseNULL_OUTPUT_STREAM.Deprecated in favor ofNULL_OUTPUT_STREAM. TODO: Will be private in 3.0.
-
-
Method Detail
-
write
public void write(byte[] b, int off, int len)Does nothing - output to/dev/null.- Overrides:
writein classjava.io.OutputStream- 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 classjava.io.OutputStream- Parameters:
b- The byte to write
-
write
public void write(byte[] b) throws java.io.IOExceptionDoes nothing - output to/dev/null.- Overrides:
writein classjava.io.OutputStream- Parameters:
b- The bytes to write- Throws:
java.io.IOException- never
-
-