public class Base64
extends java.lang.Object
Note CharBase64 is a GWT-compatible implementation of this
class.
| 限定符和类型 | 字段和说明 |
|---|---|
static boolean |
DECODE
Specify decoding (value is
false). |
static boolean |
ENCODE
Specify encoding (value is
true). |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decode(byte[] source)
Decodes Base64 content in byte array format and returns
the decoded byte array.
|
static byte[] |
decode(byte[] source,
int off,
int len)
Decodes Base64 content in byte array format and returns
the decoded byte array.
|
static byte[] |
decode(byte[] source,
int off,
int len,
byte[] decodabet)
Decodes Base64 content using the supplied decodabet and returns
the decoded byte array.
|
static byte[] |
decode(java.lang.String s)
Decodes data from Base64 notation.
|
static byte[] |
decodeWebSafe(byte[] source)
Decodes web safe Base64 content in byte array format and returns
the decoded data.
|
static byte[] |
decodeWebSafe(byte[] source,
int off,
int len)
Decodes web safe Base64 content in byte array format and returns
the decoded byte array.
|
static byte[] |
decodeWebSafe(java.lang.String s)
Decodes data from web safe Base64 notation.
|
static java.lang.String |
encode(byte[] source)
Encodes a byte array into Base64 notation.
|
static java.lang.String |
encode(byte[] source,
int off,
int len,
byte[] alphabet,
boolean doPadding)
Encodes a byte array into Base64 notation.
|
static byte[] |
encode(byte[] source,
int off,
int len,
byte[] alphabet,
int maxLineLength)
Encodes a byte array into Base64 notation.
|
static java.lang.String |
encodeWebSafe(byte[] source,
boolean doPadding)
Encodes a byte array into web safe Base64 notation.
|
public static final boolean ENCODE
true).public static final boolean DECODE
false).public static java.lang.String encode(byte[] source)
encodeBytes(source, 0, source.length)source - The data to convertpublic static java.lang.String encodeWebSafe(byte[] source,
boolean doPadding)
source - The data to convertdoPadding - is true to pad result with '=' chars
if it does not fall on 3 byte boundariespublic static java.lang.String encode(byte[] source,
int off,
int len,
byte[] alphabet,
boolean doPadding)
source - the data to convertoff - offset in array where conversion should beginlen - length of data to convertalphabet - the encoding alphabetdoPadding - is true to pad result with '=' chars
if it does not fall on 3 byte boundariespublic static byte[] encode(byte[] source,
int off,
int len,
byte[] alphabet,
int maxLineLength)
source - the data to convertoff - offset in array where conversion should beginlen - length of data to convertalphabet - is the encoding alphabetmaxLineLength - maximum length of one line.public static byte[] decode(java.lang.String s)
throws Base64DecoderException
s - the string to decode (decoded in default encoding)Base64DecoderExceptionpublic static byte[] decodeWebSafe(java.lang.String s)
throws Base64DecoderException
s - the string to decode (decoded in default encoding)Base64DecoderExceptionpublic static byte[] decode(byte[] source)
throws Base64DecoderException
source - The Base64 encoded dataBase64DecoderExceptionpublic static byte[] decodeWebSafe(byte[] source)
throws Base64DecoderException
source - the string to decode (decoded in default encoding)Base64DecoderExceptionpublic static byte[] decode(byte[] source,
int off,
int len)
throws Base64DecoderException
source - the Base64 encoded dataoff - the offset of where to begin decodinglen - the length of characters to decodeBase64DecoderExceptionpublic static byte[] decodeWebSafe(byte[] source,
int off,
int len)
throws Base64DecoderException
source - the Base64 encoded dataoff - the offset of where to begin decodinglen - the length of characters to decodeBase64DecoderExceptionpublic static byte[] decode(byte[] source,
int off,
int len,
byte[] decodabet)
throws Base64DecoderException
source - the Base64 encoded dataoff - the offset of where to begin decodinglen - the length of characters to decodedecodabet - the decodabet for decoding Base64 contentBase64DecoderException