gitzel.util
Class BasicScriptReader
public class BasicScriptReader
This class can read small scripts from various streams, readers etc. There
is no real parsing involved, rather the scripts consist of lines like this:
command arg1 arg2 arg3 ...
The getEntry(int line) method will return a string array that has the
command name in [0], and the args in the consecutive fields. getEntry(string)
should not be used directly but can be - getEntry("1-3") for example gets
you the 3rd argument of line 1.
Note that a program starts with line 0.
There are some commands that are hard-wired into this class:
- loop x - repeat next line x times (inf = endless loop)
- goto x - jumps to line x
These commands are automatically executed when the iterator is used.
private int | LineNum - The highest line number parsed yet.
|
String[] | getEntry(int line) - returns a line slashed into command, and arguments
|
int | getLineNumber() - Returns the number of lines this script has.
|
Iterator | iterator() - Returns an iterator over this object.
|
void | parse(String line) - The parsing of a line.
|
LineNum
private int LineNum
The highest line number parsed yet.
BasicScriptReader
public BasicScriptReader(BufferedReader r)
throws IOException
Reads the script from a buffered reader
BasicScriptReader
public BasicScriptReader(InputStream in)
throws IOException
Reads the script from the InputStream.
BasicScriptReader
public BasicScriptReader(String data)
throws IOException
reads the script from the given string
getEntry
public String[] getEntry(int line)
returns a line slashed into command, and arguments
getLineNumber
public int getLineNumber()
Returns the number of lines this script has.
iterator
public Iterator iterator()
Returns an iterator over this object.
parse
public void parse(String line)
The parsing of a line.
- parse in interface IniReader