Package org.apache.commons.io.output
Class ClosedOutputStream
java.lang.Object
java.io.OutputStream
org.apache.commons.io.output.ClosedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Throws an exception on all attempts to write to the stream.
Typically uses of this class include testing for corner cases in methods that accept an output stream and acting as a
sentinel value instead of a null output stream.
- Since:
- 1.4
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Throws anIOExceptionto indicate that the stream is closed.voidwrite(int b) Throws anIOExceptionto indicate that the stream is closed.Methods inherited from class java.io.OutputStream
close, nullOutputStream, write, write
-
Field Details
-
CLOSED_OUTPUT_STREAM
A singleton.
-
-
Constructor Details
-
ClosedOutputStream
public ClosedOutputStream()
-
-
Method Details
-
write
Throws anIOExceptionto indicate that the stream is closed.- Specified by:
writein classOutputStream- Parameters:
b- ignored- Throws:
IOException- always thrown
-
flush
Throws anIOExceptionto indicate that the stream is closed.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- always thrown
-