java.io.Closeable, java.io.Flushable, java.lang.AutoCloseablepublic class BrokenOutputStream
extends java.io.OutputStream
IOException from
all OutputStream methods.
This class is mostly useful for testing error handling in code that uses an output stream.
| Modifier and Type | Field | Description |
|---|---|---|
private java.io.IOException |
exception |
The exception that is thrown by all methods of this class.
|
| Constructor | Description |
|---|---|
BrokenOutputStream() |
Creates a new stream that always throws an
IOException |
BrokenOutputStream(java.io.IOException exception) |
Creates a new stream that always throws the given exception.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Throws the configured exception.
|
void |
flush() |
Throws the configured exception.
|
void |
write(int b) |
Throws the configured exception.
|
private final java.io.IOException exception
public BrokenOutputStream(java.io.IOException exception)
exception - the exception to be thrownpublic BrokenOutputStream()
IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamb - ignoredjava.io.IOException - always thrownpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException - always thrownpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException - always thrownCopyright (c) 2002-2017 Apache Software Foundation