|
||||||||||
| 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(java.io.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(java.io.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 java.io.IOException
read in class java.io.InputStreamjava.io.IOException
public int read(byte[] buffer,
int offset,
int count)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException
public int read(byte[] buffer)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException
public long skip(long count)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionpublic void mark(int readlimit)
mark in class java.io.InputStream
public void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic long getCurrentPosition()
protected abstract void countEvent(long currentPosition)
currentPosition -
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.InputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.InputStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||