本文整理匯總了Java中java.io.UnsupportedEncodingException.getCause方法的典型用法代碼示例。如果您正苦於以下問題:Java UnsupportedEncodingException.getCause方法的具體用法?Java UnsupportedEncodingException.getCause怎麽用?Java UnsupportedEncodingException.getCause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.UnsupportedEncodingException
的用法示例。
在下文中一共展示了UnsupportedEncodingException.getCause方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPostData
import java.io.UnsupportedEncodingException; //導入方法依賴的package包/類
protected String getPostData(Map<String, String> params) {
if ((params == null) || (params.size() == 0)) {
return "";
}
StringBuffer data = new StringBuffer();
for (Map.Entry entry : params.entrySet()) {
String k = (String) entry.getKey();
String v = (String) entry.getValue();
try {
data.append(URLEncoder.encode(k, "UTF-8")).append('=')
.append(URLEncoder.encode(v, "UTF-8")).append('&');
} catch (UnsupportedEncodingException e) {
e.getCause();
}
}
return data.toString();
}
示例2: toUrl
import java.io.UnsupportedEncodingException; //導入方法依賴的package包/類
@Override
public String toUrl() {
try {
String encodedUser = URLEncoder.encode(user, "UTF-8");
String encodedPassword = URLEncoder.encode(password, "UTF-8");
StringBuilder sb = new StringBuilder(
protocol.length() +
host.length() +
encodedUser.length() +
encodedPassword.length() +
type.length() + 20);
sb.append(protocol);
sb.append("://");
sb.append(encodedUser);
sb.append(":");
sb.append(encodedPassword);
sb.append("@");
sb.append(host);
sb.append(":");
sb.append(port);
sb.append("/");
sb.append(path);
sb.append(";type=");
sb.append(type);
return sb.toString();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Something occurred wrong when encode url.", e.getCause());
}
}
示例3: HttpTaskUrl
import java.io.UnsupportedEncodingException; //導入方法依賴的package包/類
protected HttpTaskUrl(String protocol, String host, int port, String path) {
super(protocol, host, port);
CheckUtil.checkStringNotNullOrEmpty(path, "filePath must not be null!");
try {
this.encodedPath = URLEncoder.encode(path, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Something occurred wrong when encode url.", e.getCause());
}
}