Package org.openstreetmap.josm.io
Class ProgressInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.openstreetmap.josm.io.ProgressInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ProgressInputStream extends InputStream
Read from an other reader and increment an progress counter while on the way.
-
-
Field Summary
Fields Modifier and Type Field Description private InputStream
in
private StreamProgressUpdater
updater
-
Constructor Summary
Constructors Constructor Description ProgressInputStream(InputStream in, long size, ProgressMonitor progressMonitor)
Constructs a newProgressInputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
read()
int
read(byte[] b, int off, int len)
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Field Detail
-
updater
private final StreamProgressUpdater updater
-
in
private final InputStream in
-
-
Constructor Detail
-
ProgressInputStream
public ProgressInputStream(InputStream in, long size, ProgressMonitor progressMonitor)
Constructs a newProgressInputStream
.- Parameters:
in
- the stream to monitor. Must not be nullsize
- the total size which will be sentprogressMonitor
- the monitor to report to- Since:
- 9172
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
-