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, write
public BrokenOutputStream(IOException exception)
exception
- the exception to be thrownpublic BrokenOutputStream()
IOException
public void write(int b) throws IOException
write
in class OutputStream
b
- ignoredIOException
- always thrownpublic void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- always thrownpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
- always thrownCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.