Package com.jalios.io
Class MonitoredInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.BufferedInputStream
com.jalios.io.MonitoredInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
A BufferedInputStream that count bytes read to display the status of
the stream.
- Author:
- Jean-Philippe
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected longprotected longFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the maxLength of the inputStreamlonggetSpentTime(boolean elapse) Return the time spent into this output streamlonggetStatus(boolean absolute, boolean done) Return the status of the stream.intread()Delegate Read to super class, count charactere read.intread(byte[] b, int off, int len) Delegate Read to super class, count charactere read.Methods inherited from class java.io.BufferedInputStream
available, close, mark, markSupported, reset, skip, transferToMethods inherited from class java.io.FilterInputStream
readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes
-
Field Details
-
maxlength
protected long maxlength -
readlength
protected long readlength -
startingTime
protected long startingTime
-
-
Constructor Details
-
MonitoredInputStream
-
-
Method Details
-
read
Delegate Read to super class, count charactere read.- Overrides:
readin classBufferedInputStream- Throws:
IOException- See Also:
-
read
Delegate Read to super class, count charactere read.- Overrides:
readin classBufferedInputStream- Throws:
IOException- See Also:
-
getStatus
public long getStatus(boolean absolute, boolean done) Return the status of the stream. How many bytes have been read.- Parameters:
absolute- if return an absolute value or percentagedone- if return the available byte or done bytes- Returns:
- long the status of the stream
-
getSpentTime
public long getSpentTime(boolean elapse) Return the time spent into this output stream- Parameters:
elapse- true return time spent, false return time to spent- Returns:
- the duration
- Since:
- jcms-4.2
-
getMaxLength
public long getMaxLength()Returns the maxLength of the inputStream- Returns:
- the maxLength of the inputStream
-