public class InterruptableInputStream extends java.io.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(java.io.InputStream inputStream) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
java.io.InputStream |
getWrappedInputStream() |
void |
interrupt() |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
public InterruptableInputStream(java.io.InputStream inputStream)
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.InputStream
public java.io.InputStream getWrappedInputStream()
getWrappedInputStream
in interface InputStreamWrapper
public void interrupt()