private int parseUTF8Char ( ) throws IOException { int ch = read ( ) ; if ( ch < 0x80 ) return ch ; else if ( ( ch & 0xe0 ) == 0xc0 ) { int ch1 = read ( ) ; int v = ( ( ch & 0x1f ) << 6 ) + ( ch1 & 0x3f ) ; return v ; } else if ( ( ch & 0xf0 ) == 0xe0 ) { int ch1 = read ( ) ; int ch2 = read ( ) ; int v = ( ( ch & 0x0f ) << 12 ) + ( ( ch1 & 0x3f ) << 6 ) + ( ch2 & 0x3f ) ; return v ; } else throw error ( "bad utf-8 encoding at " + codeName ( ch ) ) ; }
Parses a single UTF8 character .