程序包 com.ajaxjs.util
类 EncodeTools
- java.lang.Object
-
- com.ajaxjs.util.EncodeTools
-
public class EncodeTools extends Object
String URL/Base64 encoder
-
-
字段概要
字段 修饰符和类型 字段 说明 static String
UTF8_SYMBOL
UTF-8 字符串而已
-
构造器概要
构造器 构造器 说明 EncodeTools()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static byte[]
base64Decode(String str)
BASE64 解码static byte[]
base64Decoder(byte[] bytes)
BASE64 解码 这是核心解码方法,无关编码static String
base64DecodeToString(String str)
BASE64 解码static String
base64DecodeToStringUtf8(byte[] bytes)
BASE64 解码static String
base64DecodeToStringUtf8(String str)
BASE64 解码static byte[]
base64Encode(byte[] bytes)
BASE64 编码 这是核心编码方法,无关编码static String
base64EncodeToString(byte[] bytes)
BASE64 编码static String
base64EncodeToString(String str)
BASE64 编码static String
base64EncodeToStringUtf8(byte[] bytes)
BASE64 编码static String
base64EncodeToStringUtf8(String str)
BASE64 编码static String
urlChinese(String str)
URL 网址的中文乱码处理。static String
urlDecode(String str)
URL 解码static String
urlEncode(String str)
URL 编码static String
urlEncodeQuery(String str)
URL 编码。
-
-
-
方法详细资料
-
urlChinese
public static String urlChinese(String str)
URL 网址的中文乱码处理。 如果 Tomcat 过滤器设置了 UTF-8 那么这里就不用重复转码了- 参数:
str
- 通常是 URL 的 Query String 参数- 返回:
- 中文
-
urlEncodeQuery
public static String urlEncodeQuery(String str)
URL 编码。 适合 GET 请求时候用- 参数:
str
- 输入的字符串- 返回:
- 编码后的字符串
-
base64Encode
public static byte[] base64Encode(byte[] bytes)
BASE64 编码 这是核心编码方法,无关编码- 参数:
bytes
- 待编码的字符串 bytes- 返回:
- 已编码的字符串 bytes
-
base64EncodeToString
public static String base64EncodeToString(byte[] bytes)
BASE64 编码- 参数:
bytes
- 待编码的字符串 bytes- 返回:
- 已编码的字符串。使用 ISO-8859-1 字符集,请注意区别
-
base64EncodeToString
public static String base64EncodeToString(String str)
BASE64 编码- 参数:
str
- 待编码的字符串,使用 ISO-8859-1 字符集,请注意区别- 返回:
- 已编码的字符串。使用 ISO-8859-1 字符集,请注意区别
-
base64EncodeToStringUtf8
public static String base64EncodeToStringUtf8(byte[] bytes)
BASE64 编码- 参数:
bytes
- 待编码的字符串 bytes- 返回:
- 已编码的字符串。使用 UTF-8 字符集,请注意区别
-
base64EncodeToStringUtf8
public static String base64EncodeToStringUtf8(String str)
BASE64 编码- 参数:
str
- 待编码的字符串,使用 UTF-8 字符集,请注意区别- 返回:
- 已编码的字符串。使用 UTF-8 字符集,请注意区别
-
base64Decoder
public static byte[] base64Decoder(byte[] bytes)
BASE64 解码 这是核心解码方法,无关编码- 参数:
bytes
- 待解码的字符串 bytes- 返回:
- 已解码的字符串 bytes
-
base64Decode
public static byte[] base64Decode(String str)
BASE64 解码- 参数:
str
- 待解码的字符串 bytes,使用 ISO-8859-1 字符集,请注意区别- 返回:
- 已解码的字符串数据
-
base64DecodeToString
public static String base64DecodeToString(String str)
BASE64 解码- 参数:
str
- 待解码的字符串 bytes,使用 ISO-8859-1 字符集,请注意区别- 返回:
- 已解码的字符串数据
-
base64DecodeToStringUtf8
public static String base64DecodeToStringUtf8(byte[] bytes)
BASE64 解码- 参数:
bytes
- 待解码的字符串 bytes- 返回:
- 已解码的字符串。使用 UTF-8 字符集,请注意区别
-
-