public class Base64 extends Object
This class implements section 6.8. Base64 Content-Transfer-Encoding from RFC 2045 Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies by Freed and Borenstein.
Constructor and Description |
---|
Base64() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(byte[] base64Data)
Decodes Base64 data into octects
|
static byte[] |
encode(byte[] pArray)
Encodes a byte[] containing binary data, into a byte[] containing
characters in the Base64 alphabet.
|
static String |
encode(String data)
Returns the base64 encoding of String.
|
static String |
encode(String data,
String charEncoding)
Returns the base64 encoding of String (by first converting to
byte[], using the specified
charEncoding ). |
static byte[] |
encodeBase64(byte[] binaryData)
Encodes binary data using the base64 algorithm but
does not chunk the output.
|
static boolean |
isBase64(byte octect) |
static boolean |
isBase64(byte[] arrayOctect)
Tests a given byte array to see if it contains
only valid characters within the Base64 alphabet.
|
static boolean |
isBase64(String isValidString) |
public static boolean isBase64(byte octect)
public static boolean isBase64(byte[] arrayOctect)
arrayOctect
- byte array to testpublic static boolean isBase64(String isValidString)
public static byte[] encodeBase64(byte[] binaryData)
binaryData
- binary data to encodepublic static byte[] decode(byte[] base64Data)
base64Data
- Byte array containing Base64 datapublic static byte[] encode(byte[] pArray)
pArray
- a byte array containing binary datapublic static String encode(String data, String charEncoding) throws UnsupportedEncodingException
charEncoding
). The
return value is also a String. The Default
codeEncoding is ISO-8859-1
.
- Parameters:
data
- String of data to convert
charEncoding
- the character encoding to use when converting
a String to a byte[]
- Returns:
- Base64-encoded String
- Throws:
UnsupportedEncodingException