public class IndexedInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
private boolean |
finish
Indicates if we are at the end of the stream
|
private int |
index
Actual index
|
private java.io.InputStream |
inputStream
Stream to read
|
Constructor and Description |
---|
IndexedInputStream(java.io.InputStream inputStream)
Create a new instance of IndexedInputStream
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentIndex()
Current index (Number of bytes actually read)
|
boolean |
isFinish()
Indicates if we are at the end of the stream
|
int |
read()
Read one byte on the stream
Parent documentation: |
int |
read(byte[] b)
Read some bytes on trying to fill the given array
Parent documentation: |
int |
read(byte[] b,
int off,
int len)
Read some byte and write them inside a given array
Parent documentation: |
private boolean finish
private int index
private final java.io.InputStream inputStream
public IndexedInputStream(java.io.InputStream inputStream)
inputStream
- Stream to readpublic int getCurrentIndex()
public boolean isFinish()
true
if we are at the end of the streampublic int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- On reading issueInputStream.read()
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
b
- Array to filljava.io.IOException
- On reading issueInputStream.read(byte[])
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
b
- Array where write read bytesoff
- Offset inside array where start write byteslen
- Number of bytes to write at maximumjava.io.IOException
- On reading issueInputStream.read(byte[], int, int)