Package com.webmethods.rtl.encode
Class Base64
java.lang.Object
com.webmethods.rtl.encode.Base64
- Direct Known Subclasses:
Base64
Provides Base64 encoding and decoding as defined by RFC 2045.
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.
- Since:
- 1.0-dev
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decode
(byte[] base64Data) Decodes Base64 data into octectsstatic byte[]
encode
(byte[] pArray) Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.static String
Returns the base64 encoding of String.static String
Returns the base64 encoding of String (by first converting to byte[], using the specifiedcharEncoding
).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
-
Constructor Details
-
Base64
public Base64()
-
-
Method Details
-
isBase64
public static boolean isBase64(byte octect) -
isBase64
public static boolean isBase64(byte[] arrayOctect) Tests a given byte array to see if it contains only valid characters within the Base64 alphabet.- Parameters:
arrayOctect
- byte array to test- Returns:
- true if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; false, otherwise
-
isBase64
-
encodeBase64
public static byte[] encodeBase64(byte[] binaryData) Encodes binary data using the base64 algorithm but does not chunk the output.- Parameters:
binaryData
- binary data to encode- Returns:
- Base64 characters
-
decode
public static byte[] decode(byte[] base64Data) Decodes Base64 data into octects- Parameters:
base64Data
- Byte array containing Base64 data- Returns:
- Array containing decoded data.
-
encode
public static byte[] encode(byte[] pArray) Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.- Parameters:
pArray
- a byte array containing binary data- Returns:
- A byte array containing only Base64 character data
-
encode
Returns the base64 encoding of String (by first converting to byte[], using the specifiedcharEncoding
). The return value is also a String. The DefaultcodeEncoding is
ISO-8859-1
.- Parameters:
data
- String of data to convertcharEncoding
- the character encoding to use when converting a String to a byte[]- Returns:
- Base64-encoded String
- Throws:
UnsupportedEncodingException
-
encode
Returns the base64 encoding of String. First the String is converted to byte[], using the character encoding ofISO-8859-1
.- Parameters:
data
- String of data to convert- Returns:
- Base64-encoded String
-