Updated on 2022-09-01 GMT+08:00

Base64Utils

Path

com.roma.apic.livedata.common.v1.Base64Utils

Description

This class is used to provide the Base64Utils encoding and decoding functions.

Example

Base64 encoding:

importClass(com.roma.apic.livedata.common.v1.Base64Utils);
function execute(data) {
    var sourceCode = "Hello world!";
    return Base64Utils.encode(sourceCode);
}

multipart/form-data file upload:

importClass(com.roma.apic.livedata.common.v1.Base64Utils);
function execute(data) {
  var image = data.body.get("image")
  return {
    size: image.getSize(),
    name: image.getFileItem().getName(),
    base64: Base64Utils.encode(image.getFileItem().get())
  }
}

Method List

Returned Type

Method and Description

static java.lang.String

decode(java.lang.String content)

Perform Base64 decoding on a character string.

static java.lang.String

decodeUrlSafe(java.lang.String content)

Perform Base64 decoding on a character string (using the character set compatible with the URL).

static java.lang.String

encode(byte[] content)

Perform Base64 encoding on a byte array.

static java.lang.String

encode(java.lang.String content)

Perform Base64 encoding on a character string.

static java.lang.String

encodeUrlSafe(byte[] content)

Perform Base64 encoding on a byte array (using the character set compatible with the URL).

static java.lang.String

encodeUrlSafe(java.lang.String content)

Perform Base64 encoding on a character string (using the character set compatible with the URL).

Method Details

  • public static java.lang.String decode(java.lang.String content)

    Perform Base64 decoding on a character string.

    Input Parameter

    content indicates a character string encrypted by using Base64.

    Returns

    Decrypted character string.

  • public static java.lang.String decodeUrlSafe(java.lang.String content)

    Perform Base64 decoding on a byte array (using the character set compatible with the URL).

    Input Parameter

    content indicates a character string encrypted by using Base64.

    Returns

    Decrypted character string.

  • public static java.lang.String encode(byte[] content)

    Perform Base64 encoding on a byte array.

    Input Parameter

    content indicates a byte array to be encrypted.

    Returns

    Encrypted character string.

  • public static java.lang.String encode(java.lang.String content)

    Perform Base64 encoding on a character string.

    Input Parameter

    content indicates a character string to be encrypted.

    Returns

    Encrypted character string.

  • public static java.lang.String encodeUrlSafe(byte[] content)

    Perform Base64 encoding on a byte array (using the character set compatible with the URL).

    Input Parameter

    content indicates a byte array to be encrypted.

    Returns

    Encrypted character string.

  • public static java.lang.String encodeUrlSafe(java.lang.String content)

    Perform Base64 encoding on a character string (using the character set compatible with the URL).

    Input Parameter

    content indicates a character string to be encrypted.

    Returns

    Encrypted character string.