FreeHEP API
Version current

org.freehep.application
Class StoppableInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byorg.freehep.application.StoppableInputStream
All Implemented Interfaces:
BoundedRangeModel, Stoppable

public class StoppableInputStream
extends FilterInputStream
implements Stoppable, BoundedRangeModel

An input stream which also implements Stoppable. Useful when downloading files in order to provide the user with feedback on progress.

Version:
$Id: StoppableInputStream.java,v 1.1 2002/09/11 01:51:41 tonyj Exp $
Author:
Tony Johnson (tonyj@slac.stanford.edu)
Source Code:
StoppableInputStream.java

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
StoppableInputStream(InputStream in, int length)
           
StoppableInputStream(URL url)
           
 
Method Summary
 void addChangeListener(ChangeListener x)
           
 int getExtent()
           
 int getMaximum()
           
 int getMinimum()
           
 BoundedRangeModel getModel()
           
 int getValue()
           
 boolean getValueIsAdjusting()
           
 void mark(int readlimit)
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void removeChangeListener(ChangeListener x)
           
 void reset()
           
 void setExtent(int newExtent)
           
 void setMaximum(int newMaximum)
           
 void setMinimum(int newMinimum)
           
 void setRangeProperties(int value, int extent, int min, int max, boolean adjusting)
           
 void setValue(int newValue)
           
 void setValueIsAdjusting(boolean b)
           
 long skip(long n)
           
 void stop()
           
 
Methods inherited from class java.io.FilterInputStream
available, close, markSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoppableInputStream

public StoppableInputStream(URL url)
                     throws IOException

StoppableInputStream

public StoppableInputStream(InputStream in,
                            int length)
Method Detail

getModel

public BoundedRangeModel getModel()
Specified by:
getModel in interface Stoppable

stop

public void stop()
Specified by:
stop in interface Stoppable

read

public int read(byte[] b)
         throws IOException
Throws:
IOException

read

public int read()
         throws IOException
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Throws:
IOException

reset

public void reset()
           throws IOException
Throws:
IOException

mark

public void mark(int readlimit)

addChangeListener

public void addChangeListener(ChangeListener x)
Specified by:
addChangeListener in interface BoundedRangeModel

removeChangeListener

public void removeChangeListener(ChangeListener x)
Specified by:
removeChangeListener in interface BoundedRangeModel

getExtent

public int getExtent()
Specified by:
getExtent in interface BoundedRangeModel

getMaximum

public int getMaximum()
Specified by:
getMaximum in interface BoundedRangeModel

getMinimum

public int getMinimum()
Specified by:
getMinimum in interface BoundedRangeModel

getValue

public int getValue()
Specified by:
getValue in interface BoundedRangeModel

getValueIsAdjusting

public boolean getValueIsAdjusting()
Specified by:
getValueIsAdjusting in interface BoundedRangeModel

setExtent

public void setExtent(int newExtent)
Specified by:
setExtent in interface BoundedRangeModel

setMaximum

public void setMaximum(int newMaximum)
Specified by:
setMaximum in interface BoundedRangeModel

setMinimum

public void setMinimum(int newMinimum)
Specified by:
setMinimum in interface BoundedRangeModel

setRangeProperties

public void setRangeProperties(int value,
                               int extent,
                               int min,
                               int max,
                               boolean adjusting)
Specified by:
setRangeProperties in interface BoundedRangeModel

setValue

public void setValue(int newValue)
Specified by:
setValue in interface BoundedRangeModel

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Specified by:
setValueIsAdjusting in interface BoundedRangeModel

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.