public class Base64
Utilities for encoding and decoding the Base64 representation of binary data. See RFCs 2045 and 3548.
| Modifier and Type | Field and Description |
|---|---|
static int |
CRLF
Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF. Has no effect if
NO_WRAP is specified as well. |
static int |
DEFAULT
Default values for encoder/decoder flags.
|
static int |
NO_CLOSE
Flag to pass to android.util.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 /. |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode()
Decode the Base64-encoded data in input and return the data in a new byte array. The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
|
static byte[] |
decode()
Decode the Base64-encoded data in input and return the data in a new byte array. The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
|
static byte[] |
decode()
Decode the Base64-encoded data in input and return the data in a new byte array. The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
|
static byte[] |
encode()
Base64-encode the given data and return a newly allocated byte[] with the result.
|
static byte[] |
encode()
Base64-encode the given data and return a newly allocated byte[] with the result.
|
static java.lang.String |
encodeToString()
Base64-encode the given data and return a newly allocated String with the result.
|
static java.lang.String |
encodeToString()
Base64-encode the given data and return a newly allocated String with the result.
|
public static int DEFAULT
Default values for encoder/decoder flags.
public static int NO_PADDING
Encoder flag bit to omit the padding '=' characters at the end of the output (if any).
public static int NO_WRAP
Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).
public static int CRLF
Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF. Has no effect if NO_WRAP is specified as well.
public 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 /.
public static int NO_CLOSE
Flag to pass to android.util.Base64OutputStream to indicate that it should not close the output stream it is wrapping when it itself is closed.
public static byte[] decode()
Decode the Base64-encoded data in input and return the data in a new byte array.
The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
public static byte[] decode()
Decode the Base64-encoded data in input and return the data in a new byte array.
The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
public static byte[] decode()
Decode the Base64-encoded data in input and return the data in a new byte array.
The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
public static java.lang.String encodeToString()
Base64-encode the given data and return a newly allocated String with the result.
public static java.lang.String encodeToString()
Base64-encode the given data and return a newly allocated String with the result.
public static byte[] encode()
Base64-encode the given data and return a newly allocated byte[] with the result.
public static byte[] encode()
Base64-encode the given data and return a newly allocated byte[] with the result.