org.apache.lucene.util
Class CountedInputStream

Object
  extended by InputStream
      extended by FilterInputStream
          extended by CountedInputStream
All Implemented Interfaces:
Closeable

public class CountedInputStream
extends FilterInputStream

Wraps an InputStream, and counts how many bytes have been read from it.

Author:
Martin Haye

Field Summary
private  long nRead
          Count of the number of bytes read from the stream so far
 
Fields inherited from class FilterInputStream
in
 
Constructor Summary
CountedInputStream(InputStream in)
          Wrap an input stream
 
Method Summary
 boolean markSupported()
           
 long nRead()
          Find out how many bytes have been read so far
 int read()
           
 int read(byte[] b, int off, int len)
           
 long skip(long n)
           
 
Methods inherited from class FilterInputStream
available, close, mark, read, reset
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nRead

private long nRead
Count of the number of bytes read from the stream so far

Constructor Detail

CountedInputStream

public CountedInputStream(InputStream in)
Wrap an input stream

Method Detail

nRead

public long nRead()
Find out how many bytes have been read so far


read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class FilterInputStream
Throws:
IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class FilterInputStream