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 IOException 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 SummaryFieldsModifier and TypeFieldDescriptionstatic final ClosedOutputStreamDeprecated.static final ClosedOutputStreamThe singleton instance.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidflush()Throws anIOExceptionto indicate that the stream is closed.voidwrite(byte[] b, int off, int len) 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.OutputStreamclose, write
- 
Field Details- 
INSTANCEThe singleton instance.- Since:
- 2.12.0
 
- 
CLOSED_OUTPUT_STREAMDeprecated.UseINSTANCE.The singleton instance.
 
- 
- 
Constructor Details- 
ClosedOutputStreampublic ClosedOutputStream()Construct a new instance.
 
- 
- 
Method Details- 
flushThrows anIOExceptionto indicate that the stream is closed.- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- OutputStream
- Throws:
- IOException- always thrown
 
- 
writeThrows anIOExceptionto indicate that the stream is closed.- Overrides:
- writein class- OutputStream
- Parameters:
- b- ignored
- off- ignored
- len- ignored
- Throws:
- IOException- always thrown
 
- 
writeThrows anIOExceptionto indicate that the stream is closed.- Specified by:
- writein class- OutputStream
- Parameters:
- b- ignored
- Throws:
- IOException- always thrown
 
 
- 
INSTANCE.