question: @ Deprecated public static boolean encode ( final String s , final String encoding , BitSet safeOctets , boolean plusForSpace , Appendable out ) throws UnsupportedEncodingException , IOException { byte [ ] data = s . getBytes ( encoding ) ; boolean containsSpace = false ; int outputLength = 0 ; for ( int i = 0 ; i < data . length ; i ++ ) { int c = data [ i ] ; if ( c < 0 ) c += 256 ; if ( safeOctets . get ( c ) ) { out . append ( ( char ) c ) ; outputLength += 1 ; } else if ( plusForSpace && ( c == ' ' ) ) { containsSpace = true ; out . append ( '+' ) ; outputLength += 1 ; } else { out . append ( '%' ) ; out . append ( HEX_DIGITS [ c > > 4 ] ) ; out . append ( HEX_DIGITS [ c & 0xf ] ) ; outputLength += 3 ; } } return containsSpace || ( outputLength != s . length ( ) ) ; }
target:  URL-escapes s by encoding it with the specified character encoding, escaping all octets not included in safeOctets, and then outputting the result to an Appendable.