ch.randelshofer.io
Class SuspendableInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
ch.randelshofer.io.SuspendableInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class SuspendableInputStream
- extends java.io.FilterInputStream
This input stream can be used to suspend, resume and abort a worker thread
who is reading an input stream.
The methods #suspend, #resume and #abort must by called from a different
thread (the supervising thread).
- Version:
- 1.0.1 2003-04-25 Source code complies now to Java Code Conventions.
1.0 1999-05-09 Created.
- Author:
- Werner Randelshofer, Staldenmattweg 2, CH-6405 Immensee, Switzerland
| Fields inherited from class java.io.FilterInputStream |
in |
| Methods inherited from class java.io.FilterInputStream |
available, close, mark, markSupported, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SuspendableInputStream
public SuspendableInputStream(java.io.InputStream in)
suspend
public void suspend()
resume
public void resume()
abort
public void abort()
isSuspended
public boolean isSuspended()
isAborted
public boolean isAborted()
read
public int read()
throws java.io.IOException
- Overrides:
read in class java.io.FilterInputStream
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Overrides:
read in class java.io.FilterInputStream
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
read in class java.io.FilterInputStream
- Throws:
java.io.IOException