com.go.trove.io
Class PositionReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.FilterReader
              |
              +--com.go.trove.io.PositionReader
Direct Known Subclasses:
EscapeReader, LinePositionReader, PositionReader, PushbackPositionReader

public class PositionReader
extends java.io.FilterReader

The PositionReader tracks the postion in the stream of the next character to be read. PositionReaders chain together such that the position is read from the earliest PositionReader in the chain.

Position readers automatically close the underlying input stream when the end of file is reached. Ordinary input streams don't do this.

Version:
15 , 12/11/00
Author:
Brian S O'Neill

Field Summary
protected  int mPosition
           
protected  PositionReader mPosReader
          Is non-null when this PositionReader is chained to another.
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
PositionReader(java.io.Reader reader)
           
 
Method Summary
 void close()
           
 int getNextPosition()
           
 int read()
           
 int read(char[] buf, int off, int length)
           
 
Methods inherited from class java.io.FilterReader
mark, markSupported, ready, reset, skip
 
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

mPosReader

protected PositionReader mPosReader
Is non-null when this PositionReader is chained to another.

mPosition

protected int mPosition
Constructor Detail

PositionReader

public PositionReader(java.io.Reader reader)
Method Detail

getNextPosition

public int getNextPosition()
Returns:
the position of the next character to be read.

read

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

read

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

close

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