Package com.helger.commons.io.stream
Class NullOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.helger.commons.io.stream.NullOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class NullOutputStream extends OutputStream
AnOutputStreamthat discards all bytes to be written- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static NullOutputStreamNULL_OUTPUT_STREAMA singleton.
-
Constructor Summary
Constructors Constructor Description NullOutputStream()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Does not nothing and therefore does not throw an Exception.voidflush()Does not nothing and therefore does not throw an Exception.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
nullOutputStream
-
-
-
-
Field Detail
-
NULL_OUTPUT_STREAM
public static final NullOutputStream NULL_OUTPUT_STREAM
A singleton.
-
-
Constructor Detail
-
NullOutputStream
public NullOutputStream()
Default constructor. Consider usingNULL_OUTPUT_STREAMinstead.
-
-
Method Detail
-
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
-
flush
public void flush()
Does not nothing and therefore does not throw an Exception.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
close
public void close()
Does not nothing and therefore does not throw an Exception.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
-