public class BrokenReader
extends java.io.Reader
IOException
from
all the Reader
methods where the exception is declared.
This class is mostly useful for testing error handling in code that uses a reader.
Modifier and Type | Field and Description |
---|---|
private java.io.IOException |
exception
The exception that is thrown by all methods of this class.
|
Constructor and Description |
---|
BrokenReader()
Creates a new reader that always throws an
IOException |
BrokenReader(java.io.IOException exception)
Creates a new reader that always throws the given exception.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Throws the configured exception.
|
void |
mark(int readAheadLimit)
Throws the configured exception.
|
int |
read(char[] cbuf,
int off,
int len)
Throws the configured exception.
|
boolean |
ready()
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 BrokenReader(java.io.IOException exception)
exception
- the exception to be thrownpublic BrokenReader()
IOException
public int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.Reader
cbuf
- ignoredoff
- ignoredlen
- ignoredjava.io.IOException
- always thrownpublic long skip(long n) throws java.io.IOException
skip
in class java.io.Reader
n
- ignoredjava.io.IOException
- always thrownpublic boolean ready() throws java.io.IOException
ready
in class java.io.Reader
java.io.IOException
- always thrownpublic void mark(int readAheadLimit) throws java.io.IOException
mark
in class java.io.Reader
readAheadLimit
- ignoredjava.io.IOException
- always thrownpublic void reset() throws java.io.IOException
reset
in class java.io.Reader
java.io.IOException
- always thrownpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Reader
java.io.IOException
- always thrown