java.io.Closeable, java.lang.AutoCloseablepublic class BrokenInputStream
extends java.io.InputStream
IOException from
all the InputStream methods where the exception is declared.
This class is mostly useful for testing error handling in code that uses an input stream.
| Modifier and Type | Field | Description |
|---|---|---|
private java.io.IOException |
exception |
The exception that is thrown by all methods of this class.
|
| Constructor | Description |
|---|---|
BrokenInputStream() |
Creates a new stream that always throws an
IOException |
BrokenInputStream(java.io.IOException exception) |
Creates a new stream that always throws the given exception.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
available() |
Throws the configured exception.
|
void |
close() |
Throws the configured exception.
|
int |
read() |
Throws the configured exception.
|
void |
reset() |
Throws the configured exception.
|
long |
skip(long n) |
Throws the configured exception.
|
private final java.io.IOException exception
public BrokenInputStream(java.io.IOException exception)
exception - the exception to be thrownpublic BrokenInputStream()
IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - always thrownpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException - always thrownpublic long skip(long n)
throws java.io.IOException
skip in class java.io.InputStreamn - ignoredjava.io.IOException - always thrownpublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.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.InputStreamjava.io.IOException - always thrownCopyright (c) 2002-2017 Apache Software Foundation