Class ByteCountInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- fr.ens.biologie.genomique.eoulsan.io.ByteCountInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ByteCountInputStream extends FilterInputStream
This filter class allow to count the number of bytes read by an inputStream.- Since:
- 1.0
- Author:
- Laurent Jourdren
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ByteCountInputStream(InputStream is)Public constructorByteCountInputStream(InputStream is, long attemptNRead)Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longgetBytesRead()Get the number of bytes read.intread()intread(byte[] b)intread(byte[] b, int off, int len)voidreset()longskip(long n)-
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ByteCountInputStream
public ByteCountInputStream(InputStream is)
Public constructor- Parameters:
is- inputStream
-
ByteCountInputStream
public ByteCountInputStream(InputStream is, long attemptNRead)
Public constructor- Parameters:
is- inputStream
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
read
public int read() throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
getBytesRead
public long getBytesRead()
Get the number of bytes read.- Returns:
- the number of bytes read
-
-