Class MonitoredInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
ecmwf.common.technical.MonitoredInputStream
- All Implemented Interfaces:
ProgressInterface
,StreamMonitorInterface
,Closeable
,AutoCloseable
public class MonitoredInputStream
extends FilterInputStream
implements StreamMonitorInterface, ProgressInterface
The Class MonitoredInputStream.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new monitored input stream.MonitoredInputStream
(InputStream in, long delta, ProgressHandler handler) Instantiates a new monitored input stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close.void
Close and interrupt if required.long
Gets the byte sent.long
Gets the duration.long
Gets the duration on close.getRate()
Gets the rate.Gets the rate on close.Gets the simplified rate.Gets the simplified rate on close.long
Gets the start time.int
read()
Read.int
read
(byte[] b) Read.int
read
(byte[] b, int off, int len) Read.void
setByteSent
(long byteCount) Sets the byte sent.Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
MonitoredInputStream
Instantiates a new monitored input stream.- Parameters:
in
- the in
-
MonitoredInputStream
Instantiates a new monitored input stream. If delta is set to -1 then no debug is displayed in the logs.- Parameters:
in
- the indelta
- the deltahandler
- the handler
-
-
Method Details
-
close
Close.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
read
Read.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
Read.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
Read.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
setByteSent
public void setByteSent(long byteCount) Sets the byte sent.- Parameters:
byteCount
- the new byte sent
-
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
-
getStartTime
public long getStartTime()Gets the start time. Gets the start time.- Specified by:
getStartTime
in interfaceProgressInterface
- Returns:
- the start time
-
getRate
Gets the rate. Gets the rate.- Specified by:
getRate
in interfaceStreamMonitorInterface
- Returns:
- the rate
-
getRateOnClose
-
getSimplifiedRate
Gets the simplified rate. Gets the simplified rate.- Specified by:
getSimplifiedRate
in interfaceStreamMonitorInterface
- Returns:
- the simplified rate
-
getSimplifiedRateOnClose
Gets the simplified rate on close.- Returns:
- the simplified rate on close
-
getDuration
public long getDuration()Gets the duration. Gets the duration.- Specified by:
getDuration
in interfaceProgressInterface
- Specified by:
getDuration
in interfaceStreamMonitorInterface
- Returns:
- the duration
-
getDurationOnClose
public long getDurationOnClose()Gets the duration on close.- Returns:
- the duration on close
-
closeAndInterruptIfRequired
public void closeAndInterruptIfRequired()Close and interrupt if required. Close and interrupt if required.- Specified by:
closeAndInterruptIfRequired
in interfaceProgressInterface
-