|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.inxar.syntacs.analyzer.StandardInput
Concrete implementation of Input which wraps a
java.io.Reader
. This particular implementation slups
the entire input into a char array at the upon initialization, so
therefore it is fast, but it is a memory hog for large files.
Constructor Summary | |
StandardInput()
Constructs a new StandardInput instance. |
Method Summary | |
int |
atch()
"At char" (no argument): Returns the current absolute position of the input (the offset), as though an index into an array. |
void |
atch(int pos)
"At char (with argument)": Sets the input position to the given argument. |
int |
atln()
"At line": Returns the current line number. |
void |
bach(int length)
"backup chars": Moves the input "back" the given number of characters. |
int |
broach()
Returns the forthcoming char without advancing the
buffer (like a `peek'). |
void |
fetch(int offset,
int length,
char[] dst,
int dstoff)
"Fetch chars": Copies the region from offset with given length into the dst array provided starting at the given destination offset. |
int |
getch()
"Get char": Gets the next char and advances the
offset by one. |
void |
initch(Object src)
Initialize the Input source to the given Object . |
void |
patch(int dstoff,
char[] src,
int srcoff,
int len)
"Patch": change the given region starting at the given offset. |
void |
reset()
|
char |
retch(int offset)
"Return char": get the the char at the given
offset. |
char[] |
retch(int offset,
int length)
"Return chars": Gets the region from offset to length as a new character array. |
String |
stretch(int offset,
int length)
"Return chars as String": fetches the stretch of characters from offset to length as a new string. |
String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StandardInput()
StandardInput
instance.Method Detail |
public void initch(Object src) throws IOException
Input
Object
.initch
in interface Input
public void reset()
public int atch()
Input
atch
in interface Input
public void atch(int pos)
Input
atch
in interface Input
public int atln()
Input
atln
in interface Input
public void bach(int length)
Input
ungetch(3)
would move the input
pointer back three characters and therefore to the beginning
(just before 'a').bach
in interface Input
public int getch() throws IOException, EOFException
Input
char
and advances the
offset by one. If the end of input symbol has already been
returned and getch() is called again, EOFException
is thrown. Underlying IOExceptions
that may occur
are delegated to the caller.getch
in interface Input
public int broach()
Input
char
without advancing the
buffer (like a `peek'). If the end of the buffer has been
reached, -1
is returned.broach
in interface Input
public void fetch(int offset, int length, char[] dst, int dstoff)
Input
fetch
in interface Input
org.inxar.syntacs.analyzer.Input
ArrayIndexOutOfBoundsException
- if the
region ifs not valid.public char[] retch(int offset, int length)
Input
retch
in interface Input
org.inxar.syntacs.analyzer.Input
ArrayIndexOutOfBoundsException
- if the
region ifs not valid.public char retch(int offset)
Input
char
at the given
offset.retch
in interface Input
public String stretch(int offset, int length)
Input
stretch
in interface Input
org.inxar.syntacs.analyzer.Input
ArrayIndexOutOfBoundsException
- if the
region ifs not valid.public String toString()
toString
in class Object
public void patch(int dstoff, char[] src, int srcoff, int len)
Input
patch
in interface Input
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |