Class URIUtil
- java.lang.Object
-
- com.jfrog.bintray.client.impl.util.URIUtil
-
public class URIUtil extends Object
The URI escape and character encoding and decoding utility. It's compatible with {org.apache.commons.httpclient.HttpURL} rather than {org.apache.commons.httpclient.URI}.
-
-
Constructor Summary
Constructors Constructor Description URIUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
decode(String escaped)
Unescape and decode a given string regarded as an escaped string with the default protocol charset.static String
decode(String escaped, String charset)
Unescape and decode a given string regarded as an escaped string.static String
encode(String unescaped, BitSet allowed)
Escape and encode a given string with allowed characters not to be escaped and the default protocol charset.static String
encode(String unescaped, BitSet allowed, String charset)
Escape and encode a given string with allowed characters not to be escaped and a given charset.static String
encodeQuery(String unescaped)
Escape and encode a string regarded as the query component of an URI with the default protocol charset.static String
encodeQuery(String unescaped, String charset)
Escape and encode a string regarded as the query component of an URI with a given charset.
-
-
-
Method Detail
-
encodeQuery
public static String encodeQuery(String unescaped) throws org.apache.http.HttpException
Escape and encode a string regarded as the query component of an URI with the default protocol charset. When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, this method is recommended to use in encoding the whole query.- Parameters:
unescaped
- an unescaped string- Returns:
- the escaped string
- Throws:
org.apache.http.HttpException
- if the default protocol charset is not supported- See Also:
encode(java.lang.String, java.util.BitSet)
-
encodeQuery
public static String encodeQuery(String unescaped, String charset) throws org.apache.http.HttpException
Escape and encode a string regarded as the query component of an URI with a given charset. When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, this method is recommended to use in encoding the whole query.- Parameters:
unescaped
- an unescaped stringcharset
- the charset- Returns:
- the escaped string
- Throws:
org.apache.http.HttpException
- if the charset is not supported- See Also:
encode(java.lang.String, java.util.BitSet)
-
encode
public static String encode(String unescaped, BitSet allowed) throws org.apache.http.HttpException
Escape and encode a given string with allowed characters not to be escaped and the default protocol charset.- Parameters:
unescaped
- a stringallowed
- allowed characters not to be escaped- Returns:
- the escaped string
- Throws:
org.apache.http.HttpException
- if the default protocol charset is not supported
-
encode
public static String encode(String unescaped, BitSet allowed, String charset) throws org.apache.http.HttpException
Escape and encode a given string with allowed characters not to be escaped and a given charset.- Parameters:
unescaped
- a stringallowed
- allowed characters not to be escapedcharset
- the charset- Returns:
- the escaped string
- Throws:
org.apache.http.HttpException
-
decode
public static String decode(String escaped) throws org.apache.http.HttpException
Unescape and decode a given string regarded as an escaped string with the default protocol charset.- Parameters:
escaped
- a string- Returns:
- the unescaped string
- Throws:
org.apache.http.HttpException
- if the string cannot be decoded (invalid)
-
decode
public static String decode(String escaped, String charset) throws org.apache.http.HttpException
Unescape and decode a given string regarded as an escaped string.- Parameters:
escaped
- a stringcharset
- the charset- Returns:
- the unescaped string
- Throws:
org.apache.http.HttpException
- if the charset is not supported
-
-