Treeviz 0.37 2010-10-17

ch.randelshofer.io
Class SuspendableInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by 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

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
SuspendableInputStream(java.io.InputStream in)
           
 
Method Summary
 void abort()
           
 boolean isAborted()
           
 boolean isSuspended()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void resume()
           
 void suspend()
           
 
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
 

Constructor Detail

SuspendableInputStream

public SuspendableInputStream(java.io.InputStream in)
Method Detail

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

Copyright 2007-2008 (c) Werner Randelshofer.
All rights reserved.