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.
| Modifier and Type | Field and Description |
|---|---|
static BrokenInputStream |
INSTANCE
The singleton instance.
|
| Constructor and 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.
|
BrokenInputStream(java.util.function.Supplier<java.io.IOException> exceptionSupplier)
Creates a new stream that always throws an
IOException. |
| 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.
|
public static final BrokenInputStream INSTANCE
public BrokenInputStream()
IOException.public BrokenInputStream(java.io.IOException exception)
exception - the exception to be thrown.public BrokenInputStream(java.util.function.Supplier<java.io.IOException> exceptionSupplier)
IOException.exceptionSupplier - a supplier for the exception to be thrown.public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException - always thrownpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException - always thrownpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - always thrownpublic void reset()
throws java.io.IOException
reset 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 thrownCopyright © 2010 - 2023 Adobe. All Rights Reserved