public final class Base64Encoding extends Object
| Constructor and Description |
|---|
Base64Encoding() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode(String str)
Decodes a BASE64 encoded
String. |
static char[] |
encodeToChar(byte[] sArr,
int offset,
int length,
boolean lineSep)
Encodes a raw byte array into a BASE64
char[] representation
i accordance with RFC 2045. |
static String |
encodeToString(byte[] sArr,
boolean lineSep)
Encodes a raw byte array into a BASE64
String representation
i accordance with RFC 2045. |
static String |
encodeToString(byte[] sArr,
int offset,
int length,
boolean lineSep) |
public static final byte[] decode(String str)
String. All illegal characters will
be ignored and can handle both strings with and without line
separators.decode(str.toCharArray()) instead. That will create a
temporary array though. This version will use str.charAt(i)
to iterate the string.str - The source string. null or length 0 will return
an empty array.null if the legal characters (including '=') isn't
divideable by 4. (I.e. definitely corrupted).public static final char[] encodeToChar(byte[] sArr,
int offset,
int length,
boolean lineSep)
char[] representation
i accordance with RFC 2045.sArr - The bytes to convert. If null or length 0 an
empty array will be returned.lineSep - Optional "\r\n" after 76 characters, unless end of
file.null.public static final String encodeToString(byte[] sArr, boolean lineSep)
String representation
i accordance with RFC 2045.sArr - The bytes to convert. If null or length 0 an
empty array will be returned.lineSep - Optional "\r\n" after 76 characters, unless end of
file.null.public static final String encodeToString(byte[] sArr, int offset, int length, boolean lineSep)
Copyright © 2026. All rights reserved.