|
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 |
java.lang.Objectjavafe.util.CorrelatedReader
javafe.util.BufferedCorrelatedReader
javafe.util.LocationManagerCorrelatedReader
javafe.util.FileCorrelatedReader
A FileCorrelatedReader
is a
CorrelatedReader
that reads its characters from a
stream that corresponds to a file.
The class also provides a method to create a new
CorrelatedReader
for the text between the marked
position and the current point in the stream.
Location
Field Summary | |
private static int |
DEFAULTBUFSIZE
The initial size for buf |
private GenericFile |
file
The GenericFile for this CorrelatedReader. |
private static int |
READBLOCKSIZE
How big a block to read from a stream at a time |
private java.io.InputStream |
stream
The stream for this CorrelatedReader if it is open and not a subReader. |
Fields inherited from class javafe.util.LocationManagerCorrelatedReader |
curLineNo, isWholeFile, MAXFILESIZE, streamid, totalLinesRead |
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 | |
|
FileCorrelatedReader(GenericFile file)
Constructs a correlated input stream that reads its input from the specified GenericFile. |
private |
FileCorrelatedReader(java.io.InputStream in,
GenericFile file)
Constructs a correlated input stream that reads its input from the specified input stream. |
|
FileCorrelatedReader(java.io.InputStream in,
java.lang.String streamName)
This is a specialized constructor used for InputStreams that are not reopenable such as stdin. |
Method Summary | |
void |
close()
Closes us. |
(package private) static int |
createWholeFileLoc(GenericFile file)
Create a whole file location for a given GenericFile. |
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.LocationManagerCorrelatedReader |
clear, fileNumbersToNames, getCorrStreamAt, isWholeFileLoc, locToColumn, locToFile, locToLineNumber, locToOffset, locToStream, locToStreamId, makeLocation, mark, recordNewLineLocation, reset, streamIdToFile, toString |
Methods inherited from class javafe.util.BufferedCorrelatedReader |
clearMark, createReaderFromMark, getBeforeMarkLocation, getBufferFromMark, getLocation, peek, readRaw |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final int READBLOCKSIZE
private static final int DEFAULTBUFSIZE
private java.io.InputStream stream
private GenericFile file
Constructor Detail |
public FileCorrelatedReader(GenericFile file) throws java.io.IOException
public FileCorrelatedReader(java.io.InputStream in, java.lang.String streamName)
streamName is the human readable name of the stream.
private FileCorrelatedReader(java.io.InputStream in, GenericFile file)
Method Detail |
static int createWholeFileLoc(GenericFile file)
file need not be openable.
public void close()
close
in class LocationManagerCorrelatedReader
public int read() throws java.io.IOException
CorrelatedReader
class.
read
in class CorrelatedReader
java.io.IOException
protected boolean refillBuf() throws java.io.IOException
If the mark is set, and there is less that READBLOCKSIZE space left in the buffer, it allocates a larger buffer and copies markNdx..curNdx from the old buffer into the new one. If the mark is not set, then it clears the buffer. It then tries to read READBLOCKSIZE from the underlying input stream.
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.
refillBuf
in class BufferedCorrelatedReader
java.io.IOException
public GenericFile getFile()
getFile
in class CorrelatedReader
|
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 |