Class Base64


  • public final class Base64
    extends Object
    This class provides methods for performing base64 encoding and decoding. Base64 is a mechanism for encoding binary data in ASCII form by converting sets of three bytes with eight significant bits each to sets of four bytes with six significant bits each.
    • Method Detail

      • decode

        public static ByteString decode​(String base64)
        Decodes the provided base64 encoded data.
        Parameters:
        base64 - The base64 encoded data.
        Returns:
        The decoded data.
        Throws:
        org.forgerock.i18n.LocalizedIllegalArgumentException - If a problem occurs while attempting to decode base64 .
        NullPointerException - If base64 was null.
      • encode

        public static String encode​(byte[] bytes)
        Encodes the provided data as a base64 string.
        Parameters:
        bytes - The data to be encoded.
        Returns:
        The base64 encoded representation of bytes.
        Throws:
        NullPointerException - If bytes was null.
      • encode

        public static String encode​(ByteSequence bytes)
        Encodes the provided data as a base64 string.
        Parameters:
        bytes - The data to be encoded.
        Returns:
        The base64 encoded representation of bytes.
        Throws:
        NullPointerException - If bytes was null.