org.freehep.application
Class StoppableInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.freehep.application.StoppableInputStream
All Implemented Interfaces:
Closeable, 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 8584 2006-08-10 23:06:37Z duns $
Author:
Tony Johnson (tonyj@slac.stanford.edu)

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
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
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

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

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class FilterInputStream
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset in class FilterInputStream
Throws:
IOException

mark

public void mark(int readlimit)
Overrides:
mark in class FilterInputStream

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


Copyright © 2000-2006 FreeHEP. All Rights Reserved.