Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javafe.util
Class SubCorrelatedReader

    java.lang.Object
      javafe.util.CorrelatedReader
          javafe.util.BufferedCorrelatedReader
              javafe.util.SubCorrelatedReader

public class SubCorrelatedReader
extends BufferedCorrelatedReader

A reader (aka input stream) that provides an associated location with each character read.

See javafe.util.Location for the interpretation of these locations.

We also provide a method to create a new `CorrelatedReader` for the text between the marked position and the current point in the stream. Marking is also allowed on the new `CorrelatedReader` object.

Author:
  Cormac Flanagan
See Also:
  `Location`

Field Summary
`private GenericFile` | `file`

Fields inherited from class javafe.util.BufferedCorrelatedReader
`beforeBufLoc, buf, curNdx, endBufNdx, lastCharNdx, markNdx, maxLoc, minLoc, oddSlashLoc, STARTFREELOC`

Fields inherited from class javafe.util.CorrelatedReader
`marked`

Constructor Summary
`SubCorrelatedReader(GenericFile file, byte[] buf, int beforeBufLoc)` Creates a sub-reader.

Method Summary
`GenericFile` | `getFile()` Returns the file underlying this correlated reader.
`int` | `read()` See spec in the abstract `CorrelatedReader` class.
`protected boolean` | `refillBuf()` Refills the buffer.

Methods inherited from class javafe.util.BufferedCorrelatedReader
`clearMark, close, createReaderFromMark, getBeforeMarkLocation, getBufferFromMark, getLocation, mark, peek, readRaw, reset`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### file

    private GenericFile file

Constructor Detail

### SubCorrelatedReader

    public SubCorrelatedReader(GenericFile file,
                               byte[] buf,
                               int beforeBufLoc)

  Creates a sub-reader.

  This method captures the given `buf`, that is, callers should no longer use `buf` after passing it in to this constructor.

Method Detail

### getFile

    public GenericFile getFile()

  Returns the file underlying this correlated reader.

  Specified by:
    `getFile` in class `CorrelatedReader`

### read

    public int read()
             throws java.io.IOException

  See spec in the abstract `CorrelatedReader` class.

  Specified by:
    `read` in class `CorrelatedReader`
  Returns:
    A unicode character, or -1.

  Throws:
    `java.io.IOException`

### refillBuf

    protected boolean refillBuf()
                         throws java.io.IOException

  Description copied from class: `BufferedCorrelatedReader`
  Refills the buffer.

  In doing so, may reallocate the buffer.

  Returns true iff not end-of-file, and at least one character was read from the file. Throws an IOException if no characters could be read from the stream.

  Requires we are open.

  Specified by:
    `refillBuf` in class `BufferedCorrelatedReader`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

The ESC/Java2 Project Homepage