Class CountingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.deltava.dao.http.CountingInputStream
- All Implemented Interfaces:
 Closeable,AutoCloseable
An InputStream that counts the number of bytes read from it.
- Since:
 - 10.3
 - Version:
 - 10.3
 - Author:
 - Luke
 
- 
Field Summary
Fields inherited from class java.io.FilterInputStream
in - 
Constructor Summary
ConstructorsConstructorDescriptionCountingInputStream(InputStream in, IntConsumer onClose) Creates the InputStream. - 
Method Summary
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo 
- 
Constructor Details
- 
CountingInputStream
CountingInputStream(InputStream in, IntConsumer onClose) Creates the InputStream.- Parameters:
 in- the InputStream to wraponClose- statistics update hook, called on close()
 
 - 
 - 
Method Details
- 
getCount
public int getCount()Returns the number of bytes read from this stream.- Returns:
 - the number of bytes
 
 - 
read
- Overrides:
 readin classFilterInputStream- Throws:
 IOException
 - 
read
- Overrides:
 readin classFilterInputStream- Throws:
 IOException
 - 
close
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Overrides:
 closein classFilterInputStream- Throws:
 IOException
 
 -