private char readEscapeCharacter ( ) throws IOException { if ( pos == limit && ! fillBuffer ( 1 ) ) { throw syntaxError ( "Unterminated escape sequence" ) ; } char escaped = buffer [ pos ++ ] ; switch ( escaped ) { case ' ' : if ( pos + 4 > limit && ! fillBuffer ( 4 ) ) { throw syntaxError ( "Unterminated escape sequence" ) ; } // Equivalent to Integer.parseInt(stringPool.get(buffer, pos, 4), 16); char result = 0 ; for ( int i = pos , end = i + 4 ; i < end ; i ++ ) { char c = buffer [ i ] ; result <<= 4 ; if ( c >= ' ' && c <= ' ' ) { result += ( c - ' ' ) ; } else if ( c >= ' ' && c <= ' ' ) { result += ( c - ' ' + 10 ) ; } else if ( c >= ' ' && c <= ' ' ) { result += ( c - ' ' + 10 ) ; } else { throw new NumberFormatException ( "\\u" + stringPool . get ( buffer , pos , 4 ) ) ; } } pos += 4 ; return result ; case ' ' : return ' ' ; case ' ' : return ' ' ; case ' ' : return ' ' ; case ' ' : return ' ' ; case ' ' : return ' ' ; case ' ' : case ' ' : case ' ' : default : return escaped ; } }
Unescapes the character identified by the character or characters that immediately follow a backslash . The backslash \ should have already been read . This supports both unicode escapes u000A and two - character escapes \ n .