public class DotKludgeReader
extends java.io.FilterReader
This class is used in ProgressLexer
to handle files where the last
statement is not followed by the dot.
Modifier and Type | Field and Description |
---|---|
private boolean |
eof
Signals EOF condition on the underlying reader.
|
private int |
lastChar
Keeps the last read character.
|
private int |
markChar
Keeps the last read character at the mark point.
|
private boolean |
markEof
Next read after mark point will signal EOF condition.
|
Constructor and Description |
---|
DotKludgeReader(java.io.Reader in)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
mark(int readlimit)
Marks the current position in this input stream.
|
int |
read()
Reads the next byte from the input stream.
|
void |
reset()
Repositions this stream to the position at the time the mark method
was last called on this input stream.
|
private int lastChar
private boolean eof
private int markChar
private boolean markEof
public DotKludgeReader(java.io.Reader in)
in
- an input stream of any kind.public void mark(int readlimit) throws java.io.IOException
The general contract of mark is that, if the method markSupported
returns true
, the stream remembers all the bytes read
after the call to mark and stands ready to supply those same bytes
again if and whenever the method reset is called. However, the stream
is not required to remember any data at all if more than readlimit
bytes are read from the stream before reset is called.
Maintains state necessary to restore the current read position.
mark
in class java.io.FilterReader
readlimit
- The maximum limit of bytes that can be read before the mark
position becomes invalid.java.io.IOException
- If the stream does not support mark(), or if some other I/O
error occurspublic void reset() throws java.io.IOException
reset
in class java.io.FilterReader
java.io.IOException
- If the stream has not been marked, or if the mark has been
invalidated, or if the stream does not support reset(), or if
some other I/O error occurs.public int read() throws java.io.IOException
read
in class java.io.FilterReader
java.io.IOException