Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(byte[] data)
Decodes bytes from the specified byte array into a newly-allocated byte array
using the Base64 encoding scheme.
|
static byte[] |
decode(byte[] data,
boolean isMime)
Decodes bytes from the specified byte array into a newly-allocated byte array
using the Base64 encoding scheme with an option for the MIME format.
|
static byte[] |
decode(byte[] data,
int offset,
int length,
boolean isMime)
Decodes bytes from the specified byte array into a newly-allocated byte array
using the Base64 encoding scheme with an option for the MIME format.
|
static byte[] |
decode(String data,
Charset charset)
Decodes a Base64 encoded String into a newly-allocated byte array using the
Base64 encoding scheme.
|
static byte[] |
decode(String data,
Charset charset,
boolean isMime)
Decodes a Base64 encoded String into a newly-allocated byte array using the
Base64 encoding scheme with an option for the MIME format.
|
static byte[] |
encode(byte[] data)
Encodes bytes from the specified byte array into a newly-allocated byte array
using the Base64 encoding scheme.
|
static String |
encode(byte[] data,
Charset charset)
Encodes the specified byte array into a String using the Base64 encoding
scheme.
|
static byte[] |
encode(byte[] data,
int offset,
int length)
Encodes bytes from the specified byte array into a newly-allocated byte array
using the Base64 encoding scheme.
|
static String |
encode(byte[] data,
int offset,
int length,
Charset charset)
Encodes the specified byte array into a String using the Base64 encoding
scheme.
|
public static byte[] encode(byte[] data)
It uses "The Base 64 Alphabet" as specified in Table 1 of RFC 4648.
data
- the byte array to encodepublic static String encode(byte[] data, Charset charset)
It first encodes input bytes into a base64 encoded byte array by calling the
encode(byte[])
method and then constructs a new String by using the
encoded byte array and the specified charset.
data
- the byte array to encodecharset
- the charset used to encode the resulting Stringpublic static byte[] encode(byte[] data, int offset, int length)
It uses "The Base 64 Alphabet" as specified in Table 1 of RFC 4648.
data
- the byte array to encodeoffset
- offset within the array of the first byte to be encodedlength
- number of bytes to be encodedpublic static String encode(byte[] data, int offset, int length, Charset charset)
It first encodes input bytes into a base64 encoded byte array by calling the
encode(byte[])
method and then constructs a new String by using the
encoded byte array and the specified charset.
data
- the byte array to encodeoffset
- offset within the array of the first byte to be encodedlength
- number of bytes to be encodedcharset
- the charset used to encode the resulting Stringpublic static byte[] decode(byte[] data)
It uses "The Base 64 Alphabet" as specified in Table 1 of RFC 4648.
data
- the byte array to decodeIllegalArgumentException
- - if the data is not in valid Base64 schemepublic static byte[] decode(byte[] data, boolean isMime)
It uses "The Base 64 Alphabet" as specified in Table 1 of RFC 4648.
data
- the byte array to decodeisMime
- true
if the data is encoded in the MIME formatnull
if the data is not in valid Base64 schemepublic static byte[] decode(String data, Charset charset)
It first decodes the Base64 encoded String into a sequence of bytes using the
given charset and then decode the bytes by calling the
decode(byte[])
method.
data
- the string to decodecharset
- The charset to be used to encode the Stringnull
if the data is not in valid Base64 schemepublic static byte[] decode(String data, Charset charset, boolean isMime)
It first decodes the Base64 encoded String into a sequence of bytes using the
given charset and then decode the bytes by calling the
decode(byte[])
method.
data
- the string to decodeisMime
- true
if the data is encoded in the MIME formatcharset
- The charset to be used to encode the Stringnull
if the data is not in valid Base64 schemepublic static byte[] decode(byte[] data, int offset, int length, boolean isMime)
It uses "The Base 64 Alphabet" as specified in Table 1 of RFC 4648.
data
- the byte array to decodeoffset
- offset within the array of the first byte to be decodedlength
- number of bytes to be encodedisMime
- true
if the data is encoded in the MIME formatnull
if the data is not in valid Base64 schemeCopyright © 2017–2022 SNF4J.ORG. All rights reserved.