Top Description Fields Constructors Methods
com.ongres.scram.common.bouncycastle.base64

public Class Base64

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, .OutputStream, com.ongres.scram.common.bouncycastle.pbkdf2.Strings

Utility class for converting Base64 data to bytes and back again.

Field Summary

Modifier and TypeField and Description
private static final Encoder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

a byte array representing the decoded data.
decode
(byte[] data)

decode the base 64 encoded input data.

public static byte[]

Returns:

a byte array representing the decoded data.
decode
(String data)

decode the base 64 encoded String data - whitespace will be ignored.

public static int

Returns:

the number of bytes produced.
decode
(String data, OutputStream out)

decode the base 64 encoded String data writing it to the given output stream, whitespace characters will be ignored.

public static int
decode(byte[]
The source data.
base64Data
,
int
Start position.
start
,
int
the length.
length
,
OutputStream
The output stream to write to.
out
)

Decode to an output stream;

public static byte[]

Returns:

a byte array containing the base 64 encoded data.
encode
(byte[] data)

encode the input data producing a base 64 encoded byte array.

public static byte[]

Returns:

a byte array containing the base 64 encoded data.
encode
(byte[] data, int off, int length)

encode the input data producing a base 64 encoded byte array.

public static int

Returns:

the number of bytes produced.
encode
(byte[] data, OutputStream out)

Encode the byte data to base 64 writing it to the given output stream.

public static int

Returns:

the number of bytes produced.
encode
(byte[] data, int off, int length, OutputStream out)

Encode the byte data to base 64 writing it to the given output stream.

public static String
toBase64String(byte[] data)

public static String
toBase64String(byte[] data, int off, int length)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

encoderback to summary
private static final Encoder encoder

Constructor Detail

Base64back to summary
public Base64()

Method Detail

decodeback to summary
public static byte[] decode(byte[] data)

decode the base 64 encoded input data. It is assumed the input data is valid.

Returns:byte[]

a byte array representing the decoded data.

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

decode the base 64 encoded String data - whitespace will be ignored.

Returns:byte[]

a byte array representing the decoded data.

decodeback to summary
public static int decode(String data, OutputStream out) throws IOException

decode the base 64 encoded String data writing it to the given output stream, whitespace characters will be ignored.

Returns:int

the number of bytes produced.

decodeback to summary
public static int decode(byte[] base64Data, int start, int length, OutputStream out)

Decode to an output stream;

Parameters
base64Data:byte[]

The source data.

start:int

Start position.

length:int

the length.

out:OutputStream

The output stream to write to.

encodeback to summary
public static byte[] encode(byte[] data)

encode the input data producing a base 64 encoded byte array.

Returns:byte[]

a byte array containing the base 64 encoded data.

encodeback to summary
public static byte[] encode(byte[] data, int off, int length)

encode the input data producing a base 64 encoded byte array.

Returns:byte[]

a byte array containing the base 64 encoded data.

encodeback to summary
public static int encode(byte[] data, OutputStream out) throws IOException

Encode the byte data to base 64 writing it to the given output stream.

Returns:int

the number of bytes produced.

encodeback to summary
public static int encode(byte[] data, int off, int length, OutputStream out) throws IOException

Encode the byte data to base 64 writing it to the given output stream.

Returns:int

the number of bytes produced.

toBase64Stringback to summary
public static String toBase64String(byte[] data)
toBase64Stringback to summary
public static String toBase64String(byte[] data, int off, int length)