Package org.openstreetmap.josm.io
Class ProgressOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.openstreetmap.josm.io.ProgressOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class ProgressOutputStream extends java.io.OutputStream
AnOutputStream
which reports progress to theProgressMonitor
.- Since:
- 9185
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
finishOnClose
private java.io.OutputStream
out
private StreamProgressUpdater
updater
-
Constructor Summary
Constructors Constructor Description ProgressOutputStream(java.io.OutputStream out, long size, ProgressMonitor progressMonitor, boolean finishOnClose)
Constructs a newProgressOutputStream
.ProgressOutputStream(java.io.OutputStream out, long size, ProgressMonitor progressMonitor, java.lang.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)
-
-
-
Field Detail
-
updater
private final StreamProgressUpdater updater
-
out
private final java.io.OutputStream out
-
finishOnClose
private final boolean finishOnClose
-
-
Constructor Detail
-
ProgressOutputStream
public ProgressOutputStream(java.io.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(java.io.OutputStream out, long size, ProgressMonitor progressMonitor, java.lang.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 java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
-