Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.go.trove.io
Class PositionReader  view PositionReader download PositionReader.java

java.lang.Object
  extended byjava.io.Reader
      extended byjava.io.FilterReader
          extended bycom.go.trove.io.PositionReader
Direct Known Subclasses:
EscapeReader, LinePositionReader, 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

Field Summary
private  boolean mClosed
           
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()
          This method closes the stream by calling the close() method of the underlying stream.
 int getNextPosition()
           
 int read()
          Calls the in.read() method
 int read(char[] buf, int off, int length)
          Calls the in.read(char[], int, int) method.
 
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

mClosed

private boolean mClosed
Constructor Detail

PositionReader

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

getNextPosition

public int getNextPosition()

read

public int read()
         throws java.io.IOException
Description copied from class: java.io.FilterReader
Calls the in.read() method


read

public int read(char[] buf,
                int off,
                int length)
         throws java.io.IOException
Description copied from class: java.io.FilterReader
Calls the in.read(char[], int, int) method.


close

public void close()
           throws java.io.IOException
Description copied from class: java.io.FilterReader
This method closes the stream by calling the close() method of the underlying stream.