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.
| Modifier and Type | Field and Description |
|---|---|
static BrokenReader |
INSTANCE
A singleton instance using a default IOException.
|
| 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.
|
BrokenReader(java.util.function.Supplier<java.io.IOException> exceptionSupplier)
Creates a new reader that always throws an
IOException |
| 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.
|
public static final BrokenReader INSTANCE
public BrokenReader()
IOException.public BrokenReader(java.io.IOException exception)
exception - the exception to be thrown.public BrokenReader(java.util.function.Supplier<java.io.IOException> exceptionSupplier)
IOExceptionexceptionSupplier - a supplier for the exception to be thrown.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerjava.io.IOException - always thrownpublic void mark(int readAheadLimit)
throws java.io.IOException
mark in class java.io.ReaderreadAheadLimit - ignoredjava.io.IOException - always thrownpublic int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.Readercbuf - ignoredoff - ignoredlen - ignoredjava.io.IOException - always thrownpublic boolean ready()
throws java.io.IOException
ready in class java.io.Readerjava.io.IOException - always thrownpublic void reset()
throws java.io.IOException
reset in class java.io.Readerjava.io.IOException - always thrownpublic long skip(long n)
throws java.io.IOException
skip in class java.io.Readern - ignoredjava.io.IOException - always thrownCopyright © 2010 - 2023 Adobe. All Rights Reserved