Methods Summary |
---|
public void | dispose()
if (reader != null) {
try {
reader.close();
} catch (IOException ex) {
}
reader = null;
}
|
private boolean | findNext(char c)
for (;;) {
if (charsLeft == 0) {
charsLeft = reader.read(buffer, 0, BUFFER_SIZE);
if (charsLeft < 0) {
return false;
}
nextChar = 0;
}
charsLeft--;
if (c == buffer[nextChar++]) {
return true;
}
}
|
public java.lang.String | gatherNumber()
StringBuffer sb = new StringBuffer();
boolean gotNumeric = false;
for (;;) {
char c = getNext();
// Skip until we find a digit.
boolean isDigit = Character.isDigit(c);
if (!gotNumeric && !isDigit) {
continue;
}
gotNumeric = true;
if (!isDigit) {
if (c == '." || c == ',") {
continue;
}
break;
}
sb.append(c);
}
return sb.toString();
|
private char | getNext()
if (charsLeft == 0) {
charsLeft = reader.read(buffer, 0, BUFFER_SIZE);
if (charsLeft < 0) {
return (char)0;
}
nextChar = 0;
}
charsLeft--;
return buffer[nextChar++];
|
public java.lang.StringBuffer | getRestOfLine()
StringBuffer sb = new StringBuffer();
char c;
for (;;) {
c = getNext();
if (c == '\n" || c == (char)0) {
break;
}
sb.append(c);
}
return sb;
|
public boolean | moveAfterString(java.lang.String str)
char[] chars = str.toCharArray();
int count = chars.length;
char firstChar = chars[0];
char c = (char)0;
for (;;) {
if (c != firstChar && !findNext(firstChar)) {
// Reached the end of the input stream
return false;
}
boolean mismatch = false;
for (int i = 1; i < count; i++) {
c = getNext();
if (c != chars[i]) {
mismatch = true;
break;
}
}
if (!mismatch) {
return true;
}
// Mismatch. 'c' has the first mismatched
// character - start the loop again with
// that character. This is necessary because we
// could have found "wweb" while looking for "web"
}
|