Package org.openstreetmap.josm.io
Class ProgressOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.openstreetmap.josm.io.ProgressOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class ProgressOutputStream extends OutputStream
AnOutputStream
which reports progress to theProgressMonitor
.- Since:
- 9185
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
finishOnClose
private OutputStream
out
private StreamProgressUpdater
updater
-
Constructor Summary
Constructors Constructor Description ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, boolean finishOnClose)
Constructs a newProgressOutputStream
.ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, String message, boolean finishOnClose)
Constructs a newProgressOutputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
-
-
-
Field Detail
-
updater
private final StreamProgressUpdater updater
-
out
private final OutputStream out
-
finishOnClose
private final boolean finishOnClose
-
-
Constructor Detail
-
ProgressOutputStream
public ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, boolean finishOnClose)
Constructs a newProgressOutputStream
.- Parameters:
out
- the stream to monitorsize
- the total size which will be sentprogressMonitor
- the monitor to report tofinishOnClose
- whether to callProgressMonitor.finishTask()
when this stream is closed- Since:
- 10302
-
ProgressOutputStream
public ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, String message, boolean finishOnClose)
Constructs a newProgressOutputStream
.- Parameters:
out
- the stream to monitorsize
- the total size which will be sentprogressMonitor
- the monitor to report tomessage
- the message that will be displayed by the innerStreamProgressUpdater
finishOnClose
- whether to callProgressMonitor.finishTask()
when this stream is closed- Since:
- 12711
-
-
Method Detail
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
-