Package org.apache.commons.io.output
Class ClosedOutputStream
- java.lang.Object
 - 
- java.io.OutputStream
 - 
- org.apache.commons.io.output.ClosedOutputStream
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class ClosedOutputStream extends java.io.OutputStreamThrows 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
nulloutput stream.- Since:
 - 1.4
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static ClosedOutputStreamCLOSED_OUTPUT_STREAMA singleton. 
- 
Constructor Summary
Constructors Constructor Description ClosedOutputStream() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()Throws anIOExceptionto indicate that the stream is closed.voidwrite(int b)Throws anIOExceptionto indicate that the stream is closed. 
 - 
 
- 
- 
Field Detail
- 
CLOSED_OUTPUT_STREAM
public static final ClosedOutputStream CLOSED_OUTPUT_STREAM
A singleton. 
 - 
 
- 
Method Detail
- 
write
public void write(int b) throws java.io.IOExceptionThrows anIOExceptionto indicate that the stream is closed.- Specified by:
 writein classjava.io.OutputStream- Parameters:
 b- ignored- Throws:
 java.io.IOException- always thrown
 
- 
flush
public void flush() throws java.io.IOExceptionThrows anIOExceptionto indicate that the stream is closed.- Specified by:
 flushin interfacejava.io.Flushable- Overrides:
 flushin classjava.io.OutputStream- Throws:
 java.io.IOException- always thrown
 
 - 
 
 -