gzz.util
Class CountingReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.FilterReader
              |
              +--gzz.util.CountingReader

public final class CountingReader
extends java.io.FilterReader

A FilterReader that keeps track of where it is. This can be asked how many characters it has already read.


Field Summary
static java.lang.String rcsid
           
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CountingReader(java.io.Reader in)
          Create a new CountingReader reading from in.
 
Method Summary
 int getPosition()
          Return the number of characters already read.
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.FilterReader
close, ready
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rcsid

public static final java.lang.String rcsid
See Also:
Constant Field Values
Constructor Detail

CountingReader

public CountingReader(java.io.Reader in)
Create a new CountingReader reading from in.

Method Detail

getPosition

public int getPosition()
Return the number of characters already read. XXX returns a wrong value if more than Integer.MAX_INTEGER characters have been read.


read

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

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.FilterReader
java.io.IOException

skip

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

markSupported

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

mark

public void mark(int readAheadLimit)
          throws java.io.IOException
Overrides:
mark in class java.io.FilterReader
java.io.IOException

reset

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