Package jodd.util
Class Base64
java.lang.Object
jodd.util.Base64
The fastest Base64 encoder/decoder implementations.
Base64 is defined in RFC 2045.
Encoding supports two modes - with or without line separator. When line separator flag is on, result will have lines with max size of 76 chars, as per spec.
When decoding, input must be valid, without illegal characters. If input contains lines, they must be 76 chars long. Lines must end with CRLF ("\r\n"), as per spec.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]decode(byte[] arr) Decodes BASE64 encoded byte array.static byte[]decode(char[] arr) Decodes a BASE64 encoded char array.static byte[]Decodes a BASE64 encoded string.static StringdecodeToString(byte[] arr) static Stringstatic byte[]encodeToByte(byte[] arr) static byte[]encodeToByte(byte[] arr, boolean lineSep) Encodes a raw byte array into a BASE64char[].static byte[]static byte[]encodeToByte(String s, boolean lineSep) static char[]encodeToChar(byte[] arr, boolean lineSeparator) Encodes a raw byte array into a BASE64char[].static StringencodeToString(byte[] arr) static StringencodeToString(byte[] arr, boolean lineSep) Encodes a raw byte array into a BASE64String.static Stringstatic StringencodeToString(String s, boolean lineSep)
-
Field Details
-
CHARS
public static final char[] CHARS -
INV
private static final int[] INV
-
-
Constructor Details
-
Base64
public Base64()
-
-
Method Details
-
encodeToChar
public static char[] encodeToChar(byte[] arr, boolean lineSeparator) Encodes a raw byte array into a BASE64char[].- Parameters:
lineSeparator- optional CRLF after 76 chars, unless EOF.
-
decode
public static byte[] decode(char[] arr) Decodes a BASE64 encoded char array. -
encodeToByte
-
encodeToByte
-
encodeToByte
public static byte[] encodeToByte(byte[] arr) -
encodeToByte
public static byte[] encodeToByte(byte[] arr, boolean lineSep) Encodes a raw byte array into a BASE64char[].- Parameters:
lineSep- optional CRLF after 76 chars, unless EOF.
-
decodeToString
-
decode
public static byte[] decode(byte[] arr) Decodes BASE64 encoded byte array. -
encodeToString
-
encodeToString
-
encodeToString
-
encodeToString
Encodes a raw byte array into a BASE64String. -
decodeToString
-
decode
Decodes a BASE64 encoded string.
-