Top Description Fields Constructors Methods
org.yaml.snakeyaml.external.biz.base64Coder

public Class Base64Coder

extends Object
Class Inheritance

A Base64 encoder/decoder.

This class is used to encode and decode data in Base64 format as described in RFC 1521.

Project home page: www. source-code.biz/base64coder/java
Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
Multi-licensed: EPL / LGPL / GPL / AL / BSD.

Field Summary

Modifier and TypeField and Description
private static final char[]
private static final byte[]
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(String
A Base64 String to be decoded.
s
)

Decodes a byte array from Base64 format.

public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(char[]
A character array containing the Base64 encoded data.
in
)

Decodes a byte array from Base64 format.

public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(char[]
A character array containing the Base64 encoded data.
in
,
int
Offset of the first character in in to be processed.
iOff
,
int
Number of characters to process in in, starting at iOff.
iLen
)

Decodes a byte array from Base64 format.

public static byte[]

Returns:

An array containing the decoded data bytes.
decodeLines
(String
A Base64 String to be decoded.
s
)

Decodes a byte array from Base64 format and ignores line separators, tabs and blanks.

public static String

Returns:

A String containing the decoded data.
decodeString
(String
A Base64 String to be decoded.
s
)

Decodes a string from Base64 format.

public static char[]

Returns:

A character array containing the Base64 encoded data.
encode
(byte[]
An array containing the data bytes to be encoded.
in
)

Encodes a byte array into Base64 format.

public static char[]

Returns:

A character array containing the Base64 encoded data.
encode
(byte[]
An array containing the data bytes to be encoded.
in
,
int
Number of bytes to process in in.
iLen
)

Encodes a byte array into Base64 format.

public static char[]

Returns:

A character array containing the Base64 encoded data.
encode
(byte[]
An array containing the data bytes to be encoded.
in
,
int
Offset of the first byte in in to be processed.
iOff
,
int
Number of bytes to process in in, starting at iOff.
iLen
)

Encodes a byte array into Base64 format.

public static String

Returns:

A String containing the Base64 encoded data, broken into lines.
encodeLines
(byte[]
An array containing the data bytes to be encoded.
in
)

Encodes a byte array into Base 64 format and breaks the output into lines of 76 characters.

public static String

Returns:

A String containing the Base64 encoded data, broken into lines.
encodeLines
(byte[]
An array containing the data bytes to be encoded.
in
,
int
Offset of the first byte in in to be processed.
iOff
,
int
Number of bytes to be processed in in, starting at iOff.
iLen
,
int
Line length for the output data. Should be a multiple of 4.
lineLen
,
String
The line separator to be used to separate the output lines.
lineSeparator
)

Encodes a byte array into Base 64 format and breaks the output into lines.

public static String

Returns:

A String containing the Base64 encoded data.
encodeString
(String
A String to be encoded.
s
)

Encodes a string into Base64 format.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

map1back to summary
private static final char[] map1
map2back to summary
private static final byte[] map2
systemLineSeparatorback to summary
private static final String systemLineSeparator

Constructor Detail

Base64Coderback to summary
private Base64Coder()

Method Detail

decodeback to summary
public static byte[] decode(String s)

Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
s:String

A Base64 String to be decoded.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeback to summary
public static byte[] decode(char[] in)

Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
in:char[]

A character array containing the Base64 encoded data.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeback to summary
public static byte[] decode(char[] in, int iOff, int iLen)

Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
in:char[]

A character array containing the Base64 encoded data.

iOff:int

Offset of the first character in in to be processed.

iLen:int

Number of characters to process in in, starting at iOff.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeLinesback to summary
public static byte[] decodeLines(String s)

Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. CR, LF, Tab and Space characters are ignored in the input data. This method is compatible with sun.misc.BASE64Decoder.decodeBuffer(String).

Parameters
s:String

A Base64 String to be decoded.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeStringback to summary
public static String decodeString(String s)

Decodes a string from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
s:String

A Base64 String to be decoded.

Returns:String

A String containing the decoded data.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
encodeback to summary
public static char[] encode(byte[] in)

Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.

Parameters
in:byte[]

An array containing the data bytes to be encoded.

Returns:char[]

A character array containing the Base64 encoded data.

encodeback to summary
public static char[] encode(byte[] in, int iLen)

Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.

Parameters
in:byte[]

An array containing the data bytes to be encoded.

iLen:int

Number of bytes to process in in.

Returns:char[]

A character array containing the Base64 encoded data.

encodeback to summary
public static char[] encode(byte[] in, int iOff, int iLen)

Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.

Parameters
in:byte[]

An array containing the data bytes to be encoded.

iOff:int

Offset of the first byte in in to be processed.

iLen:int

Number of bytes to process in in, starting at iOff.

Returns:char[]

A character array containing the Base64 encoded data.

encodeLinesback to summary
public static String encodeLines(byte[] in)

Encodes a byte array into Base 64 format and breaks the output into lines of 76 characters. This method is compatible with sun.misc.BASE64Encoder.encodeBuffer(byte[]).

Parameters
in:byte[]

An array containing the data bytes to be encoded.

Returns:String

A String containing the Base64 encoded data, broken into lines.

encodeLinesback to summary
public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator)

Encodes a byte array into Base 64 format and breaks the output into lines.

Parameters
in:byte[]

An array containing the data bytes to be encoded.

iOff:int

Offset of the first byte in in to be processed.

iLen:int

Number of bytes to be processed in in, starting at iOff.

lineLen:int

Line length for the output data. Should be a multiple of 4.

lineSeparator:String

The line separator to be used to separate the output lines.

Returns:String

A String containing the Base64 encoded data, broken into lines.

encodeStringback to summary
public static String encodeString(String s)

Encodes a string into Base64 format. No blanks or line breaks are inserted.

Parameters
s:String

A String to be encoded.

Returns:String

A String containing the Base64 encoded data.