public class Base64Encoder extends Object
Base64编码
| 限定符和类型 | 字段和说明 |
|---|---|
private static Charset |
DEFAULT_CHARSET |
private static byte[] |
STANDARD_ENCODE_TABLE
标准编码表
|
private static byte[] |
URL_SAFE_ENCODE_TABLE
URL安全的编码表,将 + 和 / 替换为 - 和 _
|
| 构造器和说明 |
|---|
Base64Encoder() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
encode(byte[] source)
base64编码
|
static byte[] |
encode(byte[] arr,
boolean lineSep)
编码为Base64,非URL安全的
|
static byte[] |
encode(byte[] arr,
boolean isMultiLine,
boolean isUrlSafe)
编码为Base64
如果isMultiLine为 true,则每76个字符一个换行符,否则在一行显示 |
static String |
encode(CharSequence source)
base64编码
|
static String |
encode(CharSequence source,
Charset charset)
base64编码
|
static String |
encodeUrlSafe(byte[] source)
base64编码,URL安全的
|
static byte[] |
encodeUrlSafe(byte[] arr,
boolean lineSep)
编码为Base64,URL安全的
|
static String |
encodeUrlSafe(CharSequence source)
base64编码,URL安全
|
static String |
encodeUrlSafe(CharSequence source,
Charset charset)
base64编码,URL安全的
|
private static final Charset DEFAULT_CHARSET
private static final byte[] STANDARD_ENCODE_TABLE
private static final byte[] URL_SAFE_ENCODE_TABLE
public static byte[] encode(byte[] arr,
boolean lineSep)
arr - 被编码的数组lineSep - 在76个char之后是CRLF还是EOFpublic static byte[] encodeUrlSafe(byte[] arr,
boolean lineSep)
arr - 被编码的数组lineSep - 在76个char之后是CRLF还是EOFpublic static String encode(CharSequence source)
source - 被编码的base64字符串public static String encodeUrlSafe(CharSequence source)
source - 被编码的base64字符串public static String encode(CharSequence source, Charset charset)
source - 被编码的base64字符串charset - 字符集public static String encodeUrlSafe(CharSequence source, Charset charset)
source - 被编码的base64字符串charset - 字符集public static String encode(byte[] source)
source - 被编码的base64字符串public static String encodeUrlSafe(byte[] source)
source - 被编码的base64字符串public static byte[] encode(byte[] arr,
boolean isMultiLine,
boolean isUrlSafe)
true,则每76个字符一个换行符,否则在一行显示arr - 被编码的数组isMultiLine - 在76个char之后是CRLF还是EOFisUrlSafe - 是否使用URL安全字符,一般为falseCopyright © 2020. All rights reserved.