public final class SecureBase64Tool
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static int |
CRLF
Encoder flag bit to indicate lines should be terminated with a CRLF pair
instead of just an LF.
|
static int |
DEFAULT
Default values for encoder/decoder flags.
|
static int |
NO_CLOSE
Flag to pass to
Base64OutputStream to indicate that it should not
close the output stream it is wrapping when it itself is closed. |
static int |
NO_PADDING
Encoder flag bit to omit the padding '=' characters at the end of the
output (if any).
|
static int |
NO_WRAP
Encoder flag bit to omit all line terminators (i.e., the output will be
on one long line).
|
static int |
URL_SAFE
Encoder/decoder flag bit to indicate using the "URL and filename safe"
variant of Base64 (see RFC 3548 section 4) where
- and _
are used in place of + and / . |
限定符和类型 | 方法和说明 |
---|---|
byte[] |
decode(byte[] input) |
byte[] |
decode(byte[] input,
int flags)
Decode the Base64-encoded data in input and return the data in a new byte
array.
|
byte[] |
decode(byte[] input,
int offset,
int len,
int flags)
Decode the Base64-encoded data in input and return the data in a new byte
array.
|
byte[] |
decode(java.lang.String str) |
byte[] |
decode(java.lang.String str,
int flags)
Decode the Base64-encoded data in input and return the data in a new byte
array.
|
byte[] |
encode(byte[] input,
int flags)
Base64-encode the given data and return a newly allocated byte[] with the
result.
|
byte[] |
encode(byte[] input,
int offset,
int len,
int flags)
Base64-encode the given data and return a newly allocated byte[] with the
result.
|
java.lang.String |
encodeToString(byte[] input,
int flags)
Base64-encode the given data and return a newly allocated String with the
result.
|
java.lang.String |
encodeToString(byte[] input,
int offset,
int len,
int flags)
Base64-encode the given data and return a newly allocated String with the
result.
|
static SecureBase64Tool |
instance() |
public static final int DEFAULT
public static final int NO_PADDING
public static final int NO_WRAP
public static final int CRLF
NO_WRAP
is specified as
well.public static final int URL_SAFE
-
and _
are used in place of +
and /
.public static final int NO_CLOSE
Base64OutputStream
to indicate that it should not
close the output stream it is wrapping when it itself is closed.public static SecureBase64Tool instance()
public byte[] decode(java.lang.String str)
public byte[] decode(java.lang.String str, int flags)
The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
str
- the input String to decode, which is converted to bytes using
the default charsetflags
- controls certain features of the decoded output. Pass
DEFAULT
to decode standard Base64.java.lang.IllegalArgumentException
- if the input contains incorrect paddingpublic byte[] decode(byte[] input)
public byte[] decode(byte[] input, int flags)
The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
input
- the input array to decodeflags
- controls certain features of the decoded output. Pass
DEFAULT
to decode standard Base64.java.lang.IllegalArgumentException
- if the input contains incorrect paddingpublic byte[] decode(byte[] input, int offset, int len, int flags)
The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
input
- the data to decodeoffset
- the position within the input array at which to startlen
- the number of bytes of input to decodeflags
- controls certain features of the decoded output. Pass
DEFAULT
to decode standard Base64.java.lang.IllegalArgumentException
- if the input contains incorrect paddingpublic java.lang.String encodeToString(byte[] input, int flags)
input
- the data to encodeflags
- controls certain features of the encoded output. Passing
DEFAULT
results in output that adheres to RFC 2045.public java.lang.String encodeToString(byte[] input, int offset, int len, int flags)
input
- the data to encodeoffset
- the position within the input array at which to startlen
- the number of bytes of input to encodeflags
- controls certain features of the encoded output. Passing
DEFAULT
results in output that adheres to RFC 2045.public byte[] encode(byte[] input, int flags)
input
- the data to encodeflags
- controls certain features of the encoded output. Passing
DEFAULT
results in output that adheres to RFC 2045.public byte[] encode(byte[] input, int offset, int len, int flags)
input
- the data to encodeoffset
- the position within the input array at which to startlen
- the number of bytes of input to encodeflags
- controls certain features of the encoded output. Passing
DEFAULT
results in output that adheres to RFC 2045.