static String encodeUriComponent ( String source , String encoding , Type type ) throws UnsupportedEncodingException { if ( source == null ) { return null ; } Assert . hasLength ( encoding , "Encoding must not be empty" ) ; byte [ ] bytes = encodeBytes ( source . getBytes ( encoding ) , type ) ; return new String ( bytes , "US-ASCII" ) ; }
Encodes the given source into an encoded String using the rules specified by the given component and with the given options .