public class BrokenReader extends 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.
Constructor and Description |
---|
BrokenReader()
Creates a new reader that always throws an
IOException |
BrokenReader(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.
|
markSupported, read, read, read
public BrokenReader(IOException exception)
exception
- the exception to be thrownpublic BrokenReader()
IOException
public int read(char[] cbuf, int off, int len) throws IOException
read
in class Reader
cbuf
- ignoredoff
- ignoredlen
- ignoredIOException
- always thrownpublic long skip(long n) throws IOException
skip
in class Reader
n
- ignoredIOException
- always thrownpublic boolean ready() throws IOException
ready
in class Reader
IOException
- always thrownpublic void mark(int readAheadLimit) throws IOException
mark
in class Reader
readAheadLimit
- ignoredIOException
- always thrownpublic void reset() throws IOException
reset
in class Reader
IOException
- always thrownpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Reader
IOException
- always thrownCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.