question: public static String decode ( String s , Type t ) { if ( s == null ) { throw new IllegalArgumentException ( ) ; } final int n = s . length ( ) ; if ( n == 0 ) { return s ; } if ( s . indexOf ( '%' ) < 0 ) { if ( t == Type . QUERY_PARAM ) { if ( s . indexOf ( '+' ) < 0 ) { return s ; } } else { return s ; } } else { if ( n < 2 ) { throw new IllegalArgumentException ( "Malformed percent-encoded octet at index 1" ) ; } if ( s . charAt ( n - 2 ) == '%' ) { throw new IllegalArgumentException ( "Malformed percent-encoded octet at index " + ( n - 2 ) ) ; } } if ( t == null ) { return decode ( s , n ) ; } switch ( t ) { case HOST : return decodeHost ( s , n ) ; case QUERY_PARAM : return decodeQueryParam ( s , n ) ; default : return decode ( s , n ) ; } }
target:  Decodes characters of a string that are percent-encoded octets using UTF-8 decoding (if needed). <p> It is assumed that the string is valid according to an (unspecified) URI component type. If a sequence of contiguous percent-encoded octets is not a valid UTF-8 character then the octets are replaced with '\uFFFD'. <p> If the URI component is of type HOST then any "%" found between "[]" is left alone. It is an IPv6 literal with a scope_id. <p> If the URI component is of type QUERY_PARAM then any "+" is decoded as as ' '. <p>