|
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
A reader (aka input stream) that provides an associated location with each character read.
See javafe.util.Location for the interpretation of these locations.
This class also takes care of unicode conversion. A unicode character sequence consists of a backslash that is preceded by an even number of backslashes, followed by one or more 'u's, followed by four hexadecimal digits. This class converts each unicode character sequence into a single character.
This class also provides the ability to mark a specific point
in the input stream, and to reposition the stream at the marked
position. 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. For
efficiency, we also provide the facility to remove the mark from
the stream.
Location
Field Summary | |
protected boolean |
marked
True iff a mark has been set. |
Constructor Summary | |
protected |
CorrelatedReader()
Simple constructor. |
Method Summary | |
abstract void |
clearMark()
Removes the mark (if any) from the input stream. |
void |
close()
Closes us. |
abstract CorrelatedReader |
createReaderFromMark(int discard)
Creates a CorrelatedReader object for the input
text from the marked position, to the current position. |
abstract GenericFile |
getFile()
Returns the file underlying this correlated reader. |
abstract int |
getLocation()
Returns the location of the last character read. |
abstract void |
mark()
Marks the position of the current character in this input stream. |
abstract int |
read()
Reads the next character from this input stream. |
abstract void |
reset()
Repositions this stream to the position at the time the mark method was last called on this input stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean marked
Constructor Detail |
protected CorrelatedReader()
Method Detail |
public abstract GenericFile getFile()
public abstract int getLocation()
public abstract void mark()
reset
method
repositions this stream at the last marked position.
This method differs from
java.io.InputStream.readlimit
in that it does not
take a readlimit
argument.
reset()
,
clearMark()
,
createReaderFromMark(int)
public abstract void clearMark()
mark()
public abstract void reset() throws java.io.IOException
mark
method was last called on this input stream.
Requires that the input stream had been previously marked
via the mark()
method.
If mark() is called before read(), then the mark will be restored to its previous value (and not the preceeding character().
java.io.IOException
- if this stream is not marked.mark()
public abstract CorrelatedReader createReaderFromMark(int discard) throws java.lang.IndexOutOfBoundsException
CorrelatedReader
object for the input
text from the marked position, to the current position.
Calls to getLocation()
for characters from the
new CorrelatedReader
yield the same locations as
calls to getLocation()
for the same characters on
this CorrelatedReader
.
The discard
argument specifies the number of
characters to discard from the end of the
sub-CorrelatedReader
.
Clears the mark as a side-effect.
Requires that the input stream had been previously marked via
the mark()
method and that we have not been
closed.
java.lang.IndexOutOfBoundsException
- if discard
is
negative or exceeds the number of marked charactersBufferedCorrelatedReader.mark()
public void close()
public abstract int read() throws java.io.IOException
Requires we are open.
java.io.IOException
|
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 |