public 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.
| 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.
|
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 class java.io.InputStreamjava.io.IOException - always thrown