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
An
OutputStream that discards all bytes to be written- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 Details
-
NULL_OUTPUT_STREAM
A singleton.
-
-
Constructor Details
-
NullOutputStream
public NullOutputStream()Default constructor. Consider usingNULL_OUTPUT_STREAMinstead.
-
-
Method Details
-
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
Does 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
-