public class Base64Decoder extends Object
Base64解码实现
| 限定符和类型 | 类和说明 |
|---|---|
private static class |
Base64Decoder.IntWrapper
int包装,使之可变
|
| 限定符和类型 | 字段和说明 |
|---|---|
private static byte[] |
DECODE_TABLE
Base64解码表,共128位,-1表示非base64字符,-2表示padding
|
private static Charset |
DEFAULT_CHARSET |
private static byte |
PADDING |
| 构造器和说明 |
|---|
Base64Decoder() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decode(byte[] in)
解码Base64
|
static byte[] |
decode(byte[] in,
int pos,
int length)
解码Base64
|
static byte[] |
decode(CharSequence source)
base64解码
|
static String |
decodeStr(CharSequence source)
base64解码
|
static String |
decodeStr(CharSequence source,
Charset charset)
base64解码
|
private static byte |
getNextValidDecodeByte(byte[] in,
Base64Decoder.IntWrapper pos,
int maxPos)
获取下一个有效的byte字符
|
private static final Charset DEFAULT_CHARSET
private static final byte PADDING
private static final byte[] DECODE_TABLE
public static String decodeStr(CharSequence source)
source - 被解码的base64字符串public static String decodeStr(CharSequence source, Charset charset)
source - 被解码的base64字符串charset - 字符集public static byte[] decode(CharSequence source)
source - 被解码的base64字符串public static byte[] decode(byte[] in)
in - 输入public static byte[] decode(byte[] in,
int pos,
int length)
in - 输入pos - 开始位置length - 长度private static byte getNextValidDecodeByte(byte[] in,
Base64Decoder.IntWrapper pos,
int maxPos)
in - 输入pos - 当前位置,调用此方法后此位置保持在有效字符的下一个位置maxPos - 最大位置Copyright © 2020. All rights reserved.