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:
java.io.Closeable
,java.lang.AutoCloseable
public class MonitoredInputStream extends java.io.BufferedInputStream
A BufferedInputStream that count bytes read to display the status of the stream.- Version:
- $Revision: 43452 $
- Author:
- Jean-Philippe
-
-
Field Summary
Fields Modifier and Type Field Description protected long
maxlength
protected long
readlength
static java.lang.String
REVISION
protected long
startingTime
-
Constructor Summary
Constructors Constructor Description MonitoredInputStream(java.io.InputStream stream, int size, long maxlength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getMaxLength()
Returns the maxLength of the inputStreamlong
getSpentTime(boolean elapse)
Return the time spent into this output streamlong
getStatus(boolean absolute, boolean done)
Return the status of the stream.int
read()
Delegate Read to super class, count charactere read.int
read(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
-
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
maxlength
protected long maxlength
-
readlength
protected long readlength
-
startingTime
protected long startingTime
-
-
Method Detail
-
read
public int read() throws java.io.IOException
Delegate Read to super class, count charactere read.- Overrides:
read
in classjava.io.BufferedInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read()
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
Delegate Read to super class, count charactere read.- Overrides:
read
in classjava.io.BufferedInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read(byte[], int, int)
-
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
-
-