Share via


Base64 Class

  • java.lang.Object
    • com.microsoft.azure.storage.core.Base64

public class Base64

RESERVED FOR INTERNAL USE. Provides Base64 encoding, decoding, and validation functionality.

Method Summary

Modifier and Type Method and Description
byte [] decode(final String data)

Decodes a given Base64 string into its corresponding byte array.

Byte [] decodeAsByteObjectArray(final String data)

Decodes a given Base64 string into its corresponding byte array.

String encode(final byte[] data)

Encodes a byte array as a Base64 string.

String encode(final Byte[] data)

Encodes a byte array as a Base64 string.

boolean validateIsBase64String(final String data)

Determines whether the given string contains only Base64 characters.

Method Details

decode

public static byte [] decode(final String data)

Decodes a given Base64 string into its corresponding byte array.

Parameters:

data - the Base64 string, as a String object, to decode

Returns:

the corresponding decoded byte array

Throws:

IllegalArgumentException - If the string is not a valid base64 encoded string

decodeAsByteObjectArray

public static Byte [] decodeAsByteObjectArray(final String data)

Decodes a given Base64 string into its corresponding byte array.

Parameters:

data - the Base64 string, as a String object, to decode

Returns:

the corresponding decoded byte array

Throws:

IllegalArgumentException - If the string is not a valid base64 encoded string

encode

public static String encode(final byte[] data)

Encodes a byte array as a Base64 string.

Parameters:

data - the byte array to encode

Returns:

the Base64-encoded string, as a String object

encode

public static String encode(final Byte[] data)

Encodes a byte array as a Base64 string.

Parameters:

data - the byte array to encode

Returns:

the Base64-encoded string, as a String object

validateIsBase64String

public static boolean validateIsBase64String(final String data)

Determines whether the given string contains only Base64 characters.

Parameters:

data - the string, as a String object, to validate

Returns:

true if data is a valid Base64 string, otherwise false

Applies to