private static String encodeUriComponent ( final String source , final String encoding , final URIPart uriPart ) { if ( source == null ) { return null ; } byte [ ] bytes = encodeBytes ( StringUtil . getBytes ( source , encoding ) , uriPart ) ; char [ ] chars = new char [ bytes . length ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { chars [ i ] = ( char ) bytes [ i ] ; } return new String ( chars ) ; }
Encodes single URI component .