public int read() throws IOException {
  if (hasNextChar) {
    hasNextChar=false;
    write(nextChar);
    return nextChar;
  }
  if (previousLine != lexer.getLine()) {
    numUnicodeEscapesFoundOnCurrentLine=0;
    previousLine=lexer.getLine();
  }
  int c=reader.read();
  if (c != '\\') {
    write(c);
    return c;
  }
  c=reader.read();
  if (c != 'u') {
    hasNextChar=true;
    nextChar=c;
    write('\\');
    return '\\';
  }
  int numberOfUChars=0;
  do {
    numberOfUChars++;
    c=reader.read();
  }
 while (c == 'u');
  checkHexDigit(c);
  StringBuilder charNum=new StringBuilder();
  charNum.append((char)c);
  for (int i=0; i < 3; i++) {
    c=reader.read();
    checkHexDigit(c);
    charNum.append((char)c);
  }
  int rv=Integer.parseInt(charNum.toString(),16);
  write(rv);
  numUnicodeEscapesFound+=4 + numberOfUChars;
  numUnicodeEscapesFoundOnCurrentLine+=4 + numberOfUChars;
  return rv;
}

public int read ( ) throws IOException { if ( hasNextChar ) { hasNextChar = false ; write ( nextChar ) ; return nextChar ; } if ( previousLine != lexer . getLine ( ) ) { numUnicodeEscapesFoundOnCurrentLine = 0 ; previousLine = lexer . getLine ( ) ; } int c = reader . read ( ) ; if ( c != '\\' ) { write ( c ) ; return c ; } c = reader . read ( ) ; if ( c != 'u' ) { hasNextChar = true ; nextChar = c ; write ( '\\' ) ; return '\\' ; } int numberOfUChars = 0 ; do { numberOfUChars ++ ; c = reader . read ( ) ; } while ( c == 'u' ) ; checkHexDigit ( c ) ; StringBuilder charNum = new StringBuilder ( ) ; charNum . append ( ( char ) c ) ; for ( int i = 0 ; i < 3 ; i ++ ) { c = reader . read ( ) ; checkHexDigit ( c ) ; charNum . append ( ( char ) c ) ; } int rv = Integer . parseInt ( charNum . toString ( ) , 16 ) ; write ( rv ) ; numUnicodeEscapesFound += 4 + numberOfUChars ; numUnicodeEscapesFoundOnCurrentLine += 4 + numberOfUChars ; return rv ; }
gets the next character from the underlying reader , translating escapes as required .
