public class Base64Utils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static char[] |
S_BASE64CHAR |
private static char |
S_BASE64PAD |
private static byte[] |
S_DECODETABLE |
| Constructor and Description |
|---|
Base64Utils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode(char[] data,
int off,
int len) |
static void |
decode(char[] data,
int off,
int len,
java.io.OutputStream ostream) |
static byte[] |
decode(java.lang.String data) |
static void |
decode(java.lang.String data,
java.io.OutputStream ostream) |
private static int |
decode0(char[] ibuf,
byte[] obuf,
int wp) |
static java.lang.String |
encode(byte[] data)
Returns base64 representation of specified byte array.
|
static java.lang.String |
encode(byte[] data,
int off,
int len)
Returns base64 representation of specified byte array.
|
static void |
encode(byte[] data,
int off,
int len,
java.io.OutputStream ostream)
Outputs base64 representation of the specified byte array to a byte stream.
|
static void |
encode(byte[] data,
int off,
int len,
java.lang.StringBuffer buffer)
Outputs base64 representation of the specified byte array to the specified String Buffer
|
static void |
encode(byte[] data,
int off,
int len,
java.io.Writer writer)
Outputs base64 representation of the specified byte array to a character stream.
|
static java.lang.String |
encode(javax.activation.DataHandler dh)
Get a base64 representation of the content of a given
DataHandler as a string. |
static char[] |
encodeToCharArray(javax.activation.DataHandler dh)
Get a base64 representation of the content of a given
DataHandler as a char array. |
private static int |
getBufferSize(javax.activation.DataHandler dh) |
private static int |
getEncodedSize(int unencodedSize) |
static boolean |
isValidBase64Encoding(java.lang.String data)
checks input string for invalid Base64 characters
|
private static final char[] S_BASE64CHAR
private static final char S_BASE64PAD
private static final byte[] S_DECODETABLE
private static int getEncodedSize(int unencodedSize)
private static int getBufferSize(javax.activation.DataHandler dh)
public static java.lang.String encode(javax.activation.DataHandler dh)
throws java.io.IOException
DataHandler as a string.
This method will try to carry out the encoding operation in the most efficient way.dh - the data handler with the content to encodejava.io.IOException - if an I/O error occurs when reading the content of the data handlerpublic static char[] encodeToCharArray(javax.activation.DataHandler dh)
throws java.io.IOException
DataHandler as a char array.
This method will try to carry out the encoding operation in the most efficient way.dh - the data handler with the content to encodejava.io.IOException - if an I/O error occurs when reading the content of the data handlerprivate static int decode0(char[] ibuf,
byte[] obuf,
int wp)
public static byte[] decode(char[] data,
int off,
int len)
public static byte[] decode(java.lang.String data)
public static boolean isValidBase64Encoding(java.lang.String data)
data - public static void decode(char[] data,
int off,
int len,
java.io.OutputStream ostream)
throws java.io.IOException
java.io.IOExceptionpublic static void decode(java.lang.String data,
java.io.OutputStream ostream)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String encode(byte[] data)
public static java.lang.String encode(byte[] data,
int off,
int len)
public static void encode(byte[] data,
int off,
int len,
java.lang.StringBuffer buffer)
public static void encode(byte[] data,
int off,
int len,
java.io.OutputStream ostream)
throws java.io.IOException
java.io.IOExceptionpublic static void encode(byte[] data,
int off,
int len,
java.io.Writer writer)
throws java.io.IOException
java.io.IOException