public 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 and Description |
|---|
InterruptableInputStream(InputStream inputStream) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
InputStream |
getWrappedInputStream() |
void |
interrupt() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
mark, markSupported, read, reset, skippublic 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 Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic InputStream getWrappedInputStream()
getWrappedInputStream in interface InputStreamWrapperpublic void interrupt()