code: private int assertToken(final StreamTokenizer tokeniser, Reader in,
              final String token, final boolean ignoreCase, final boolean isBeginToken) throws IOException,
              ParserException {
  
          // ensure next token is a word token..
          String sval;
          int ntok;
          if(isBeginToken) {
              ntok = skipNewLines(tokeniser, in, token);
              sval = getSvalIgnoringBom(tokeniser, in, token);
          } else {
              ntok = assertToken(tokeniser, in, StreamTokenizer.TT_WORD);
              sval = tokeniser.sval;
          }
  
          if (ignoreCase) {
              if (!token.equalsIgnoreCase(sval)) {
                  throw new ParserException(MessageFormat.format(UNEXPECTED_TOKEN_MESSAGE, token, sval), getLineNumber(tokeniser, in));
              }
          }
          else if (!token.equals(sval)) {
              throw new ParserException(MessageFormat.format(UNEXPECTED_TOKEN_MESSAGE, token, sval), getLineNumber(tokeniser, in));
          }
  
          if (log.isDebugEnabled()) {
              log.debug("[" + token + "]");
          }
          return ntok;
      }
docs: Asserts that the next token in the stream matches the specified token.
  
  @param tokeniser stream tokeniser to perform assertion on
  @param in
  @param token     expected token
  @param ignoreCase
  @param isBeginToken
  @return int value of the ttype field of the tokeniser
  @throws IOException     when unable to read from stream
  @throws ParserException when next token in the stream does not match the expected token