Class MonitoredOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
ecmwf.common.technical.MonitoredOutputStream
- All Implemented Interfaces:
ProgressInterface
,StreamMonitorInterface
,Closeable
,Flushable
,AutoCloseable
public class MonitoredOutputStream
extends FilterOutputStream
implements StreamMonitorInterface, ProgressInterface
The Class MonitoredOutputStream.
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new monitored output stream.MonitoredOutputStream
(OutputStream out, ProgressHandler handler) Instantiates a new monitored output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close.void
Close and interrupt if required.long
Gets the byte sent.long
Gets the duration.getRate()
Gets the rate.Gets the simplified rate.long
Gets the start time.void
write
(byte[] b) Write.void
write
(byte[] b, int off, int len) Write.void
write
(int b) Write.Methods inherited from class java.io.FilterOutputStream
flush
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
MonitoredOutputStream
Instantiates a new monitored output stream.- Parameters:
out
- the out
-
MonitoredOutputStream
Instantiates a new monitored output stream.- Parameters:
out
- the outhandler
- the handler
-
-
Method Details
-
close
Close.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
write
Write.- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
Write.- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
Write.- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
getByteSent
public long getByteSent()Gets the byte sent. Gets the byte sent.- Specified by:
getByteSent
in interfaceProgressInterface
- Specified by:
getByteSent
in interfaceStreamMonitorInterface
- Returns:
- the byte sent
-
getRate
Gets the rate. Gets the rate.- Specified by:
getRate
in interfaceStreamMonitorInterface
- Returns:
- the rate
-
getSimplifiedRate
Gets the simplified rate. Gets the simplified rate.- Specified by:
getSimplifiedRate
in interfaceStreamMonitorInterface
- Returns:
- the simplified rate
-
getStartTime
public long getStartTime()Gets the start time. Gets the start time.- Specified by:
getStartTime
in interfaceProgressInterface
- Returns:
- the start time
-
getDuration
public long getDuration()Gets the duration. Gets the duration.- Specified by:
getDuration
in interfaceProgressInterface
- Specified by:
getDuration
in interfaceStreamMonitorInterface
- Returns:
- the duration
-
closeAndInterruptIfRequired
public void closeAndInterruptIfRequired()Close and interrupt if required. Close and interrupt if required.- Specified by:
closeAndInterruptIfRequired
in interfaceProgressInterface
-