Closeable, AutoCloseable, InputStreamWrapperpublic class InterruptableInputStream extends InputStream implements InputStreamWrapper
Note: This hacky class does not really solve the problem of interrupting blocking Java input streams, as it cannot unblock a blocked read operation. It really just serves as a convenient way to interrupt streams before any potentially blocking operations.
| Constructor | Description |
|---|---|
InterruptableInputStream(InputStream inputStream) |
| Modifier and Type | Method | Description |
|---|---|---|
int |
available() |
|
void |
close() |
|
InputStream |
getWrappedInputStream() |
|
void |
interrupt() |
|
int |
read() |
|
int |
read(byte[] b,
int off,
int len) |
mark, markSupported, read, readAllBytes, readNBytes, reset, skip, transferTopublic InterruptableInputStream(InputStream inputStream)
public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic int available()
throws IOException
available in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface AutoCloseableclose in interface Closeableclose in class InputStreamIOExceptionpublic InputStream getWrappedInputStream()
getWrappedInputStream in interface InputStreamWrapperpublic void interrupt()