com.sun.jimi.util
Class ByteCountInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--com.sun.jimi.util.ByteCountInputStream

public class ByteCountInputStream
extends java.io.InputStream

This class provides a way to count the bytes of data that have been read from the underlying input stream at any given time. This class has to be used carefully, if it is used underneath a buffering class then it just reports how far the buffering has gotten.


Field Summary
protected  long count
           
protected  java.io.InputStream in
           
 
Constructor Summary
ByteCountInputStream(java.io.InputStream in)
           
 
Method Summary
 int available()
           
 void close()
           
 long getCount()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 void resetCount()
          To be complete a way to allow from which point the couting takes place.
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

protected java.io.InputStream in

count

protected long count
Constructor Detail

ByteCountInputStream

public ByteCountInputStream(java.io.InputStream in)
Method Detail

getCount

public long getCount()
Returns:
the number of bytes which have been read through this class from the underlying input stream

resetCount

public void resetCount()
To be complete a way to allow from which point the couting takes place.

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.InputStream

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream

close

public void close()
           throws java.io.IOException
Overrides:
close in class java.io.InputStream

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream