|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
sk.baka.ambient.commons.CountingInputStream
public abstract class CountingInputStream
Counts bytes which are being read.
| Field Summary | |
|---|---|
int |
blockLength
Fire events only when a block of given size (in bytes) has been read. |
| Constructor Summary | |
|---|---|
CountingInputStream(InputStream in,
int blockLength)
Creates new counting stream instance. |
|
| Method Summary | |
|---|---|
int |
available()
|
void |
close()
|
protected abstract void |
countEvent(long currentPosition)
Invoked when the position |
long |
getCurrentPosition()
Returns number of bytes already read. |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] buffer)
|
int |
read(byte[] buffer,
int offset,
int count)
|
void |
reset()
|
long |
skip(long count)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int blockLength
| Constructor Detail |
|---|
public CountingInputStream(InputStream in,
int blockLength)
in - poll this stream.blockLength - Fire events only when a block of given size (in bytes) has
been read. This prevents firing events after each byte read.| Method Detail |
|---|
public int read()
throws IOException
read in class InputStreamIOException
public int read(byte[] buffer,
int offset,
int count)
throws IOException
read in class InputStreamIOException
public int read(byte[] buffer)
throws IOException
read in class InputStreamIOException
public long skip(long count)
throws IOException
skip in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStream
public void reset()
throws IOException
reset in class InputStreamIOExceptionpublic long getCurrentPosition()
protected abstract void countEvent(long currentPosition)
currentPosition -
public int available()
throws IOException
available in class InputStreamIOException
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||