public class BrokenInputStream extends 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 and Description |
---|
BrokenInputStream()
Creates a new stream that always throws an
IOException |
BrokenInputStream(IOException exception)
Creates a new stream that always throws the given exception.
|
Modifier and Type | Method and 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.
|
mark, markSupported, read, read
public BrokenInputStream(IOException exception)
exception
- the exception to be thrownpublic BrokenInputStream()
IOException
public int read() throws IOException
read
in class InputStream
IOException
- always thrownpublic int available() throws IOException
available
in class InputStream
IOException
- always thrownpublic long skip(long n) throws IOException
skip
in class InputStream
n
- ignoredIOException
- always thrownpublic void reset() throws IOException
reset
in class InputStream
IOException
- always thrownpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
- always thrownCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.