Package org.forgerock.am.cts.utils.blob
Class TokenBlobUtils
java.lang.Object
org.forgerock.am.cts.utils.blob.TokenBlobUtils
Responsible for handling the encoding and decoding of the binary object format
the CTS Token.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Convert the String contents into an encoded binary representation.getBlobAsString
(Token token) Retrieve the blob data of the Token in String format.void
setBlobFromString
(Token token, String blob) Assign the given String to the Token by converting it to a byte[] first.toUTF8
(byte[] data) Convert a byte array into a String using the UTF-8 encoding.
-
Field Details
-
ENCODING
- See Also:
-
-
Constructor Details
-
TokenBlobUtils
public TokenBlobUtils()
-
-
Method Details
-
getBlobAsString
Retrieve the blob data of the Token in String format.- Parameters:
token
- Non null.- Returns:
- maybe null if the Token has not binary data assigned.
- Throws:
IllegalStateException
- If there was a problem decoding the string.
-
setBlobFromString
Assign the given String to the Token by converting it to a byte[] first.- Parameters:
token
- Non null Token.blob
- Non null String data to convert to binary and store in Token.- Throws:
IllegalStateException
- If there was a problem encoding the String.
-
toUTF8
Convert a byte array into a String using the UTF-8 encoding.- Parameters:
data
- Non null byte[] to be converted.- Returns:
- A non null but possibly empty.
- Throws:
UnsupportedEncodingException
- indicates there was a problem decoding the data.
-
fromUTF8
Convert the String contents into an encoded binary representation.- Parameters:
contents
- Non null contents to convert.- Returns:
- Non null response.
- Throws:
UnsupportedEncodingException
- If there was an error performing the conversion.
-