org.openstreetmap.josm.io
Class ProgressInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.openstreetmap.josm.io.ProgressInputStream
All Implemented Interfaces:
java.io.Closeable

public class ProgressInputStream
extends java.io.InputStream

Read from an other reader and increment an progress counter while on the way.


Field Summary
private  java.net.URLConnection connection
           
private  java.io.InputStream in
           
private  int lastDialogUpdate
           
private  ProgressMonitor progressMonitor
           
private  int readSoFar
           
private  boolean sizeKnown
           
 
Constructor Summary
ProgressInputStream(java.net.URLConnection con, ProgressMonitor progressMonitor)
           
 
Method Summary
private  void advanceTicker(int amount)
          Increase ticker (progress counter and displayed text) by the given amount.
 void close()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
private  void updateSize()
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private final java.io.InputStream in

readSoFar

private int readSoFar

lastDialogUpdate

private int lastDialogUpdate

sizeKnown

private boolean sizeKnown

connection

private final java.net.URLConnection connection

progressMonitor

private final ProgressMonitor progressMonitor
Constructor Detail

ProgressInputStream

public ProgressInputStream(java.net.URLConnection con,
                           ProgressMonitor progressMonitor)
                    throws OsmTransferException
Throws:
OsmTransferException
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

advanceTicker

private void advanceTicker(int amount)
Increase ticker (progress counter and displayed text) by the given amount.

Parameters:
amount -

updateSize

private void updateSize()


JOSM