Utilities Service

Utilities

This service provides utilities for string encoding/decoding, date formatting, JSON manipulation, and other miscellaneous tasks.

Classes

NameBrief description
CharsetA typesafe enum for character sets.
DigestAlgorithmSelector of Digest algorithm.
MacAlgorithmSelector of MAC algorithm
RsaAlgorithmSelector of RSA algorithm
UtilitiesThis service provides utilities for string encoding/decoding, date formatting, JSON manipulation, and other miscellaneous tasks.

Charset

Properties

PropertyTypeDescription
US_ASCIIEnum
UTF_8Enum

DigestAlgorithm

Properties

PropertyTypeDescription
MD2EnumMD2 algorithm
MD5EnumMD5 algorithm
SHA_1EnumSHA-1 algorithm
SHA_256EnumSHA-256 algorithm
SHA_384EnumSHA-384 algorithm
SHA_512EnumSHA-512 algorithm

MacAlgorithm

Properties

PropertyTypeDescription
HMAC_MD5Enum
HMAC_SHA_1Enum
HMAC_SHA_256Enum
HMAC_SHA_384Enum
HMAC_SHA_512Enum

RsaAlgorithm

Properties

PropertyTypeDescription
RSA_SHA_1Enum
RSA_SHA_256Enum

Utilities

Properties

PropertyTypeDescription
CharsetCharset
DigestAlgorithmDigestAlgorithm
MacAlgorithmMacAlgorithm
RsaAlgorithmRsaAlgorithm

Methods

MethodReturn typeBrief description
base64Decode(encoded)Byte[]Decodes a base-64 encoded string into a UTF-8 byte array.
base64Decode(encoded, charset)Byte[]Decodes a base-64 encoded string into a byte array in a specific character set.
base64DecodeWebSafe(encoded)Byte[]Decodes a base-64 web-safe encoded string into a UTF-8 byte array.
base64DecodeWebSafe(encoded, charset)Byte[]Decodes a base-64 web-safe encoded string into a byte array in a specific character set.
base64Encode(data)StringGenerates a base-64 encoded string from the given byte array.
base64Encode(data)StringGenerates a base-64 encoded string from the given string.
base64Encode(data, charset)StringGenerates a base-64 encoded string from the given string in a specific character set.
base64EncodeWebSafe(data)StringGenerates a base-64 web-safe encoded string from the given byte array.
base64EncodeWebSafe(data)StringGenerates a base-64 web-safe encoded string from the given string.
base64EncodeWebSafe(data, charset)StringGenerates a base-64 web-safe encoded string from the given string in a specific character set.
computeDigest(algorithm, value)Byte[]Compute a digest using the specified algorithm on the specified Byte[] value.
computeDigest(algorithm, value)Byte[]Compute a digest using the specified algorithm on the specified String value.
computeDigest(algorithm, value, charset)Byte[]Compute a digest using the specified algorithm on the specified String value with the given character set.
computeHmacSha256Signature(value, key)Byte[]Signs the provided value using HMAC-SHA256 with the given key.
computeHmacSha256Signature(value, key)Byte[]Signs the provided value using HMAC-SHA256 with the given key.
computeHmacSha256Signature(value, key, charset)Byte[]Signs the provided value using HMAC-SHA256 with the given key and character set.
computeHmacSignature(algorithm, value, key)Byte[]Compute a message authentication code using the specified algorithm on the specified key and value.
computeHmacSignature(algorithm, value, key)Byte[]Compute a message authentication code using the specified algorithm on the specified key and value.
computeHmacSignature(algorithm, value, key, charset)Byte[]Compute a message authentication code using the specified algorithm on the specified key and value.
computeRsaSha1Signature(value, key)Byte[]Signs the provided value using RSA-SHA1 with the given key.
computeRsaSha1Signature(value, key, charset)Byte[]Signs the provided value using RSA-SHA1 with the given key and charset.
computeRsaSha256Signature(value, key)Byte[]Signs the provided value using RSA-SHA256 with the given key.
computeRsaSha256Signature(value, key, charset)Byte[]Signs the provided value using RSA-SHA256 with the given key.
computeRsaSignature(algorithm, value, key)Byte[]Signs the provided value using the specified RSA algorithm with the given key.
computeRsaSignature(algorithm, value, key, charset)Byte[]Signs the provided value using the specified RSA algorithm with the given key and charset.
formatDate(date, timeZone, format)StringFormats date according to specification described in Java SE SimpleDateFormat class.
formatString(template, args)StringPerforms sprintf-like string formatting using '%'-style format strings.
getUuid()StringGet a UUID as a string (equivalent to using the java.util.UUID.randomUUID() method).
gzip(blob)Blobgzip-compresses the provided Blob data and returns it in a new Blob object.
gzip(blob, name)Blobgzip-compresses the provided Blob data and returns it in a new Blob object.
newBlob(data)BlobCreate a new Blob object from a byte array.
newBlob(data, contentType)BlobCreate a new Blob object from a byte array and content type.
newBlob(data, contentType, name)BlobCreate a new Blob object from a byte array, content type, and name.
newBlob(data)BlobCreate a new Blob object from a string.
newBlob(data, contentType)BlobCreate a new Blob object from a string and content type.
newBlob(data, contentType, name)BlobCreate a new Blob object from a string, content type, and name.
parseCsv(csv)String[][]Returns a tabular 2D array representation of a CSV string.
parseCsv(csv, delimiter)String[][]Returns a tabular 2D array representation of a CSV string using a custom delimiter.
parseDate(date, timeZone, format)DateParses the provided string date according to the specification described in the Java Standard Edition SimpleDateFormat class.
sleep(milliseconds)voidSleeps for specified number of milliseconds.
ungzip(blob)BlobUncompresses a Blob object and returns a Blob containing the uncompressed data.
unzip(blob)Blob[]Takes a Blob representing a zip file and returns its component files.
zip(blobs)BlobCreates a new Blob object that is a zip file containing the data from the Blobs passed in.
zip(blobs, name)BlobCreates a new Blob object that is a zip file containing the data from the Blobs passed in.