
com.aliyun.credentials.utils.AcsURLEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of credentials-java Show documentation
Show all versions of credentials-java Show documentation
Alibaba Cloud Credentials for Java
Copyright (C) Alibaba Cloud Computing
All rights reserved.
版权所有 (C)阿里云计算有限公司
https://www.aliyun.com
package com.aliyun.credentials.utils;
import com.aliyun.credentials.exception.CredentialException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
public class AcsURLEncoder {
public final static String URL_ENCODING = "UTF-8";
public static String encode(String value) {
try {
return URLEncoder.encode(value, URL_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new CredentialException(e.getMessage(), e);
}
}
public static String percentEncode(String value) {
try {
return value != null ? URLEncoder.encode(value, URL_ENCODING).replace("+", "%20")
.replace("*", "%2A").replace("%7E", "~") : null;
} catch (UnsupportedEncodingException e) {
throw new CredentialException(e.getMessage(), e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy