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 TypeMethodDescriptionvoidclose()Close.voidClose and interrupt if required.longGets the byte sent.longGets the duration.longGets the duration on close.getRate()Gets the rate.Gets the rate on close.Gets the simplified rate.Gets the simplified rate on close.longGets the start time.intread()Read.intread(byte[] b) Read.intread(byte[] b, int off, int len) Read.voidsetByteSent(long byteCount) Sets the byte sent.Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset, skipMethods 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
read
Read.- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
Read.- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
Read.- Overrides:
readin 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:
getByteSentin interfaceProgressInterface- Specified by:
getByteSentin interfaceStreamMonitorInterface- Returns:
- the byte sent
-
getStartTime
public long getStartTime()Gets the start time. Gets the start time.- Specified by:
getStartTimein interfaceProgressInterface- Returns:
- the start time
-
getRate
Gets the rate. Gets the rate.- Specified by:
getRatein interfaceStreamMonitorInterface- Returns:
- the rate
-
getRateOnClose
-
getSimplifiedRate
Gets the simplified rate. Gets the simplified rate.- Specified by:
getSimplifiedRatein 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:
getDurationin interfaceProgressInterface- Specified by:
getDurationin 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:
closeAndInterruptIfRequiredin interfaceProgressInterface
-