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 void
close()
long
getBytesRead()
Get the number of bytes read.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
reset()
long
skip(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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
getBytesRead
public long getBytesRead()
Get the number of bytes read.- Returns:
- the number of bytes read
-
-