public class BrokenWriter extends Writer
IOException
from
all Writer
methods.
This class is mostly useful for testing error handling in code that uses a writer.
Constructor and Description |
---|
BrokenWriter()
Creates a new writer that always throws an
IOException |
BrokenWriter(IOException exception)
Creates a new writer that always throws the given exception.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Throws the configured exception.
|
void |
flush()
Throws the configured exception.
|
void |
write(char[] cbuf,
int off,
int len)
Throws the configured exception.
|
public BrokenWriter(IOException exception)
exception
- the exception to be thrownpublic BrokenWriter()
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
cbuf
- ignoredoff
- ignoredlen
- ignoredIOException
- always thrownpublic void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
- always thrownpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
- always thrownJas4pp 1.5 © Java Analysis Studio for Particle Physics