Base64

Provides <a href="http://en.wikipedia.org/wiki/Base64">Base 64</a> encoding and decoding as defined by <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>. <p/> This class implements section <cite>6.8. Base64 Content-Transfer-Encoding</cite> from RFC 2045 <cite>Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</cite> by Freed and Borenstein. <p/> This class was borrowed from Apache Commons Codec SVN repository (rev. 618419) with modifications to enable Base64 conversion without a full dependency on Commons Codec. We didn't want to reinvent the wheel of great work they've done, but also didn't want to force every Shiro user to depend on the commons-codec.jar <p/> As per the Apache 2.0 license, the original copyright notice and all author and copyright information have remained in tact.

@see <a href="http://en.wikipedia.org/wiki/Base64">Wikipedia: Base 64</a> @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> @since 0.9

Members

Static functions

decode
byte[] decode(string base64Encoded)

Converts the specified UTF-8 Base64 encoded string and decodes it to a raw Base64 decoded byte array.

decode
byte[] decode(byte[] base64Data)

Decodes Base64 data into octets

encode
byte[] encode(byte[] pArray)

Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.

encode
byte[] encode(byte[] binaryData, bool isChunked)

Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks.

encodeChunked
byte[] encodeChunked(byte[] binaryData)

Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks

encodeToString
string encodeToString(byte[] bytes)

Base64 encodes the specified byte array and then encodes it as a string using Shiro's preferred character encoding (UTF-8).

Variables

CHUNK_SEPARATOR
enum byte[] CHUNK_SEPARATOR;

Chunk separator per RFC 2045 section 2.1.

CHUNK_SIZE
enum int CHUNK_SIZE;

Chunk size per RFC 2045 section 6.8. <p/> The character limit does not count the trailing CRLF, but counts all other characters, including any equal signs.

Meta