private StringBuffer buffer;
/**
+ * Lookahead token.
+ */
+ private Token lastToken;
+
+ /**
* Constructs a new RTFScanner without initializing the {@link Reader}.
*/
private RTFScanner()
*
* @throws IOException if the underlying stream has problems
*/
- public Token readToken()
+ private Token readTokenImpl()
throws IOException
{
Token token = null;
return token;
}
+ Token peekToken()
+ throws IOException
+ {
+ lastToken = readTokenImpl();
+ return lastToken;
+ }
+
+ Token readToken()
+ throws IOException
+ {
+ Token token;
+ if (lastToken != null)
+ {
+ token = lastToken;
+ lastToken = null;
+ }
+ else
+ token = readTokenImpl();
+ return token;
+ }
+
/**
* Reads in a control word and optional parameter.
*