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()
IOExceptionpublic void write(char[] cbuf, int off, int len) throws IOException
write in class Writercbuf - ignoredoff - ignoredlen - ignoredIOException - always thrownpublic void flush() throws IOException
flush in interface Flushableflush in class WriterIOException - always thrownpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOException - always thrownCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.