本文整理了Java中org.apache.commons.httpclient.URI.decode()
方法的一些代码示例,展示了URI.decode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.decode()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.URI
类名称:URI
方法名:decode
[英]Decodes URI encoded string. This is a two mapping, one from URI characters to octets, and subsequently a second from octets to original characters:
URI character sequence->octet sequence->original character sequence
A URI must be separated into its components before the escaped characters within those components can be allowedly decoded.
Notice that there is a chance that URI characters that are non UTF-8 may be parsed as valid UTF-8. A recent non-scientific analysis found that EUC encoded Japanese words had a 2.7% false reading; SJIS had a 0.0005% false reading; other encoding such as ASCII or KOI-8 have a 0% false reading.
The percent "%" character always has the reserved purpose of being the escape indicator, it must be escaped as "%25" in order to be used as data within a URI.
The unescape method is internally performed within this method.
[中]解码URI编码的字符串。这是一个两个映射,一个从URI字符到八位字节,然后第二个从八位字节到原始字符:
URI character sequence->octet sequence->original character sequence
在允许对URI中的转义字符进行解码之前,必须将URI拆分为其组件。
请注意,非UTF-8的URI字符可能会被解析为有效的UTF-8。最近的一项非科学分析发现,EUC编码的日语单词有2.7%的误读率;SJIS的错误读数为0.0005%;ASCII或KOI-8等其他编码的错误读取率为0%。
百分比“%”字符始终具有作为转义指示符的保留用途,必须将其转义为“%25”,才能用作URI中的数据。
unescape方法在该方法内部执行。
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Unescape and decode a given string.
*
* @param escapedComponent an being-unescaped component
* @param charset the charset to decode
* @return the escaped and encoded string
*
* @throws URIException if the charset is not supported
*
* @deprecated use org.apache.commons.codec.net.URLCodec
*/
public static String decode(char[] escapedComponent, String charset)
throws URIException {
return URI.decode(escapedComponent, charset);
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the query.
*
* @return the query string.
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getQuery() throws URIException {
return (_query == null) ? null : decode(_query, getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the userinfo.
*
* @return the userinfo
* @throws URIException If {@link #decode} fails
* @see #getAuthority
*/
public String getUserinfo() throws URIException {
return (_userinfo == null) ? null : decode(_userinfo,
getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the fragment.
*
* @return the fragment string
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getFragment() throws URIException {
return (_fragment == null) ? null : decode(_fragment,
getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* It can be gotten the URI character sequence.
*
* @return the original URI string
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getURI() throws URIException {
return (_uri == null) ? null : decode(_uri, getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the authority.
*
* @return the authority
* @throws URIException If {@link #decode} fails
*/
public String getAuthority() throws URIException {
return (_authority == null) ? null : decode(_authority,
getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
throw new IllegalArgumentException("Component array of chars may not be null");
return decode(new String(component), charset);
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the host.
* <p><blockquote><pre>
* host = hostname | IPv4address | IPv6reference
* </pre></blockquote><p>
*
* @return the host
* @throws URIException If {@link #decode} fails
* @see #getAuthority
*/
public String getHost() throws URIException {
if (_host != null) {
return decode(_host, getProtocolCharset());
} else {
return null;
}
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the level above the this hierarchy level.
*
* @return the above hierarchy level
* @throws URIException If {@link #getRawCurrentHierPath(char[])} fails.
* @see #decode
*/
public String getAboveHierPath() throws URIException {
char[] path = getRawAboveHierPath();
return (path == null) ? null : decode(path, getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the current hierarchy level.
*
* @return the current hierarchy level
* @throws URIException If {@link #getRawCurrentHierPath(char[])} fails.
* @see #decode
*/
public String getCurrentHierPath() throws URIException {
char[] path = getRawCurrentHierPath();
return (path == null) ? null : decode(path, getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the original URI reference string.
*
* @return the original URI reference string
* @throws URIException If {@link #decode} fails.
*/
public String getURIReference() throws URIException {
char[] uriReference = getRawURIReference();
return (uriReference == null) ? null : decode(uriReference,
getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the path.
* <p><blockquote><pre>
* path = [ abs_path | opaque_part ]
* </pre></blockquote><p>
* @return the path string
* @throws URIException If {@link #decode} fails.
* @see #decode
*/
public String getPath() throws URIException {
char[] path = getRawPath();
return (path == null) ? null : decode(path, getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the path and query.
*
* @return the path and query string.
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getPathQuery() throws URIException {
char[] rawPathQuery = getRawPathQuery();
return (rawPathQuery == null) ? null : decode(rawPathQuery,
getProtocolCharset());
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Get the basename of the path.
*
* @return the basename string
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getName() throws URIException {
char[] basename = getRawName();
return (basename == null) ? null : decode(getRawName(),
getProtocolCharset());
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* Get the query.
*
* @return the query string.
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getQuery() throws URIException {
return (_query == null) ? null : decode(_query, getProtocolCharset());
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* Get the fragment.
*
* @return the fragment string
* @throws URIException incomplete trailing escape pattern or unsupported
* character encoding
* @see #decode
*/
public String getFragment() throws URIException {
return (_fragment == null) ? null : decode(_fragment,
getProtocolCharset());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Get the userinfo.
*
* @return the userinfo
* @throws URIException If {@link #decode} fails
* @see #getAuthority
*/
public String getUserinfo() throws URIException {
return (_userinfo == null) ? null : decode(_userinfo,
getProtocolCharset());
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* Get the current hierarchy level.
*
* @return the current hierarchy level
* @throws URIException If {@link #getRawCurrentHierPath(char[])} fails.
* @see #decode
*/
public String getCurrentHierPath() throws URIException {
char[] path = getRawCurrentHierPath();
return (path == null) ? null : decode(path, getProtocolCharset());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Get the original URI reference string.
*
* @return the original URI reference string
* @throws URIException If {@link #decode} fails.
*/
public String getURIReference() throws URIException {
char[] uriReference = getRawURIReference();
return (uriReference == null) ? null : decode(uriReference,
getProtocolCharset());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Get the level above the this hierarchy level.
*
* @return the above hierarchy level
* @throws URIException If {@link #getRawCurrentHierPath(char[])} fails.
* @see #decode
*/
public String getAboveHierPath() throws URIException {
char[] path = getRawAboveHierPath();
return (path == null) ? null : decode(path, getProtocolCharset());
}
内容来源于网络,如有侵权,请联系作者删除!