|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ByteCounter
This Interface provides for tracking the number of bytes read/written. The Stream given by directio Utility classes for use by a class implementing IterativeReader/IterativeWriter implements this Interface so that the number of bytes read/written can easily be tracked without tracking each read/write/skip call.
The method to initialize read/write of the class implementing IterativeReader or IterativeWriter can check if the Stream is an instance of this Interface and setup the counter if it is.
Method Summary | |
---|---|
long |
getTotalBytes()
This method returns the Total Number of Bytes read/written since the Creation of the Stream. |
void |
setCounter(int[] counterArr,
boolean upMode)
This increments/decrements the supplied integer counter as and when bytes are read/written. |
Method Detail |
---|
void setCounter(int[] counterArr, boolean upMode)
counterArr
- Array countaining the counter. counterArr[0] will be
incremented/decremented by the number of bytes as and when bytes are
read/written/skipped. counterArr[0] is not changed otherwise. The
application using the counter is free to reset it. For example an
IterativeReader can initialize the counterArr[0] to number of bytes to
be read at the beginning of the nextRead call and can check if
counterArr[0] > 0 to determine if the required bytes have been read.upMode
- Pass as true to indicate the counter is to be incremented.
False if it is to be decremented.long getTotalBytes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |