Package org.apache.commons.io.output
Class ClosedWriter
java.lang.Object
java.io.Writer
org.apache.commons.io.output.ClosedWriter
- All Implemented Interfaces:
- Closeable,- Flushable,- Appendable,- AutoCloseable
Throws an IOException on all attempts to write with 
close() implemented as a noop.
 
 Typically uses of this class include testing for corner cases in methods that accept a writer and acting as a
 sentinel value instead of a null writer.
 
- Since:
- 2.7
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ClosedWriterDeprecated.static final ClosedWriterThe singleton instance.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()voidflush()Throws anIOExceptionto indicate that the stream is closed.voidwrite(char[] cbuf, int off, int len) Throws anIOExceptionto indicate that the writer is closed.
- 
Field Details- 
INSTANCEThe singleton instance.- Since:
- 2.12.0
 
- 
CLOSED_WRITERDeprecated.UseINSTANCE.The singleton instance.
 
- 
- 
Constructor Details- 
ClosedWriterpublic ClosedWriter()Construct a new instance.
 
- 
- 
Method Details- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein class- Writer
- Throws:
- IOException
 
- 
flushThrows anIOExceptionto indicate that the stream is closed.- Specified by:
- flushin interface- Flushable
- Specified by:
- flushin class- Writer
- Throws:
- IOException- always thrown
 
- 
writeThrows anIOExceptionto indicate that the writer is closed.- Specified by:
- writein class- Writer
- Parameters:
- cbuf- ignored
- off- ignored
- len- ignored
- Throws:
- IOException- always thrown
 
 
- 
INSTANCE.