@Override public char nextChar() { if (start >= length) { return reader.nextChar(); } else { return lookahead[start++]; } }
public void lookahead(int numberOfCharacters) { numberOfCharacters += length - start; if (lookahead.length < numberOfCharacters) { lookahead = Arrays.copyOf(lookahead, numberOfCharacters); } if (start >= length) { start = 0; length = 0; } try { numberOfCharacters -= length; while (numberOfCharacters-- > 0) { lookahead[length] = reader.nextChar(); length++; } } catch (EOFException ex) { // ignore. } }