Base64

org.parboiled2.util.Base64
See theBase64 companion object
class Base64(alphabet: String)

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def decode(sArr: Array[Char]): Array[Byte]

Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with and without line separators.

Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with and without line separators.

Value parameters

sArr

The source array. null or length 0 will return an empty array.

Attributes

Returns

The decoded array of bytes. May be of length 0. Will be null if the legal characters (including '=') isn't divideable by 4. (I.e. definitely corrupted).

def decodeFast(sArr: Array[Char]): Array[Byte]

Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as fast as [[#decode(char[])]]. The preconditions are:

Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as fast as [[#decode(char[])]]. The preconditions are:

  • The array must have a line length of 76 chars OR no line separators at all (one line).
  • Line separator must be "\r\n", as specified in RFC 2045
  • The array must not contain illegal characters within the encoded string
  • The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.

Value parameters

sArr

The source array. Length 0 will return an empty array. null will throw an exception.

Attributes

Returns

The decoded array of bytes. May be of length 0.

def encodeToChar(sArr: Array[Byte], lineSep: Boolean): Array[Char]

Encodes a raw byte array into a BASE64 char[] representation i accordance with RFC 2045.

Encodes a raw byte array into a BASE64 char[] representation i accordance with RFC 2045.

Value parameters

lineSep

Optional "\r\n" after 76 characters, unless end of file.
No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a little faster.

sArr

The bytes to convert. If null or length 0 an empty array will be returned.

Attributes

Returns

A BASE64 encoded array. Never null.

def encodeToString(sArr: Array[Byte], lineSep: Boolean): String

Encodes a raw byte array into a BASE64 String representation in accordance with RFC 2045.

Encodes a raw byte array into a BASE64 String representation in accordance with RFC 2045.

Value parameters

lineSep

Optional "\r\n" after 76 characters, unless end of file.
No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a little faster.

sArr

The bytes to convert. If null or length 0 an empty array will be returned.

Attributes

Returns

A BASE64 encoded array. Never null.

def getAlphabet: Array[Char]

Concrete fields

val CA: Array[Char]
val IA: Array[Int]
val fillChar: Char