First page Back Continue Last page Summary Graphic
Scanner Framework (2)
public class Scanner implements Tokens {
public Scanner(InputStream in) {
this.in = in;
this.buf = new StringBuffer();
nextCh();
}
public int token; // the current token class
public String chars; // token representation
private InputStream in; // the input stream
private char ch; // the current character
private final char EOF_CH = (char)-1;
private StringBuffer buf;
public void nextToken() {
...
}
private void nextCh() {
try {
ch = (char)in.read();
} catch (IOException e) {
error(e.toString());
}
}