private static void escape ( OutputAccessor out , int charToEscape ) { out . write ( ' ' ) ; out . write ( ' ' ) ; if ( charToEscape > 0xFF ) { int hi = ( charToEscape >> 8 ) & 0xFF ; out . write ( HEX_BYTES [ hi >> 4 ] ) ; out . write ( HEX_BYTES [ hi & 0xF ] ) ; charToEscape &= 0xFF ; } else { out . write ( ( byte ) ' ' ) ; out . write ( ( byte ) ' ' ) ; } // We know it's a control char, so only the last 2 chars are non-0 out . write ( HEX_BYTES [ charToEscape >> 4 ] ) ; out . write ( HEX_BYTES [ charToEscape & 0xF ] ) ; }
Write a UTF escape sequence using either an one or two - byte seqience .