public class Base64Util extends Object
| Modifier and Type | Field and Description |
|---|---|
private static String |
DEFAULT_CHARSET |
private static char[] |
map1 |
private static byte[] |
map2 |
| Modifier | Constructor and Description |
|---|---|
private |
Base64Util() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode(char[] in)
Decodes a byte array from Base64 format.
|
static byte[] |
decode(String s)
Decodes a byte array from Base64 format.
|
static String |
decodeString(String s)
Invoke
decodeString(String, String) with DEFAULT_CHARSET |
static String |
decodeString(String s,
String charset)
Decodes a string from Base64 format.
|
static char[] |
encode(byte[] in)
Encodes a byte array into Base64 format.
|
static char[] |
encode(byte[] in,
int iLen)
Encodes a byte array into Base64 format.
|
static String |
encodeString(String s)
Invoke
encodeString(String, String) with DEFAULT_CHARSET |
static String |
encodeString(String s,
String charset)
Encodes a string into Base64 format.
|
private static final String DEFAULT_CHARSET
private static char[] map1
private static byte[] map2
public static String encodeString(String s, String charset) throws UnsupportedEncodingException
s - a String to be encoded.charset - when convert string to byte arrat use this charsetUnsupportedEncodingException - if specified charset not supportedpublic static String encodeString(String s)
encodeString(String, String) with DEFAULT_CHARSETs - a String to be encoded.public static char[] encode(byte[] in)
in - an array containing the data bytes to be encoded.public static char[] encode(byte[] in,
int iLen)
in - an array containing the data bytes to be encoded.iLen - number of bytes to process in in.public static String decodeString(String s, String charset) throws UnsupportedEncodingException
s - a Base64 String to be decoded.charset - when convert byte array to string use this charsetIllegalArgumentException - if the input is not valid Base64 encoded data.UnsupportedEncodingException - if specified charset not supportedpublic static String decodeString(String s)
decodeString(String, String) with DEFAULT_CHARSETs - a Base64 String to be decoded.public static byte[] decode(String s)
s - a Base64 String to be decoded.IllegalArgumentException - if the input is not valid Base64 encoded data.public static byte[] decode(char[] in)
in - a character array containing the Base64 encoded data.IllegalArgumentException - if the input is not valid Base64 encoded data.Copyright © 2015. All rights reserved.