public class BrokenOutputStream extends OutputStream
IOException from
all OutputStream methods.
This class is mostly useful for testing error handling in code that uses an output stream.
| Constructor and Description |
|---|
BrokenOutputStream()
Creates a new stream that always throws an
IOException |
BrokenOutputStream(IOException exception)
Creates a new stream 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(int b)
Throws the configured exception.
|
write, writepublic BrokenOutputStream(IOException exception)
exception - the exception to be thrownpublic BrokenOutputStream()
IOExceptionpublic void write(int b) throws IOException
write in class OutputStreamb - ignoredIOException - always thrownpublic void flush() throws IOException
flush in interface Flushableflush in class OutputStreamIOException - always thrownpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOException - always thrownCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.