Package org.apache.commons.io.output
Class BrokenWriter
- java.lang.Object
 - 
- java.io.Writer
 - 
- org.apache.commons.io.output.BrokenWriter
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class BrokenWriter extends java.io.WriterBroken writer. This writer always throws anIOExceptionfrom allWritermethods.This class is mostly useful for testing error handling in code that uses a writer.
- Since:
 - 2.0
 
 
- 
- 
Constructor Summary
Constructors Constructor Description BrokenWriter()Creates a new writer that always throws anIOExceptionBrokenWriter(java.io.IOException exception)Creates a new writer that always throws the given exception. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Throws the configured exception.voidflush()Throws the configured exception.voidwrite(char[] cbuf, int off, int len)Throws the configured exception. 
 - 
 
- 
- 
Method Detail
- 
write
public void write(char[] cbuf, int off, int len) throws java.io.IOExceptionThrows the configured exception.- Specified by:
 writein classjava.io.Writer- Parameters:
 cbuf- ignoredoff- ignoredlen- ignored- Throws:
 java.io.IOException- always thrown
 
- 
flush
public void flush() throws java.io.IOExceptionThrows the configured exception.- Specified by:
 flushin interfacejava.io.Flushable- Specified by:
 flushin classjava.io.Writer- Throws:
 java.io.IOException- always thrown
 
- 
close
public void close() throws java.io.IOExceptionThrows the configured exception.- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Specified by:
 closein classjava.io.Writer- Throws:
 java.io.IOException- always thrown
 
 - 
 
 -