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() |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
mark, read, skip
public InterruptableInputStream(InputStream inputStream)
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
public InputStream getWrappedInputStream()
getWrappedInputStream
in interface InputStreamWrapper
public void interrupt()
Copyright © 2006–2018. All rights reserved.