org.jagatoo.util.streams
Class CountingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.jagatoo.util.streams.CountingInputStream
All Implemented Interfaces:
java.io.Closeable

public class CountingInputStream
extends java.io.InputStream

Counts all read/skipped bytes.

Author:
Marvin Froehlich (aka Qudus)

Constructor Summary
CountingInputStream(java.io.InputStream in)
           
 
Method Summary
 int available()
          
 long getCount()
          Gets the number of written bytes.
 int read()
          
 int read(byte[] b)
          
 int read(byte[] b, int off, int len)
          
 long skip(long n)
          
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountingInputStream

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

getCount

public final long getCount()
Gets the number of written bytes.

Returns:
the number of written bytes.

available

public int available()
              throws java.io.IOException

Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException

Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException

Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException

Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException