Package com.portal.pcm
Class PCMUtils
java.lang.Object
com.portal.pcm.PCMUtils
Class to host utility methods which can be used by other classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
convertBase64ToBytes
(String base64EncodedStr) Convert Base64 encoded string to bytes array.static String
convertBytesToBase64
(byte[] bytes) Convert input bytes to Base64 encoded string.static String
convertBytesToHex
(byte[] bytes) Convert input bytes to hex encoded string.static byte[]
convertHexToBytes
(String hexString) Convert input hex encoded string to bytes.static long
rfc3339FormatToUnixTime
(String rfc3339DateStr) Method to convert from RFC3339 format 1970-05-23T21:21:18.18Z to Unix time (seconds from epoch) format.static String
unixTimeToRFC3339Format
(long secondsFromEpoch) Method to convert from Unix time (seconds from epoch) format to RFC3339 format 1970-05-23T21:21:18.18Z
-
Constructor Details
-
PCMUtils
public PCMUtils()
-
-
Method Details
-
convertBytesToHex
Convert input bytes to hex encoded string.- Parameters:
bytes
- Input byte array.- Returns:
- Hex encoded string.
-
convertHexToBytes
Convert input hex encoded string to bytes.- Parameters:
hexString
- Hex encoded string.- Returns:
- Input byte array.
-
convertBytesToBase64
Convert input bytes to Base64 encoded string.- Parameters:
bytes
- Input byte array.- Returns:
- base64 encoded string.
-
convertBase64ToBytes
Convert Base64 encoded string to bytes array.- Parameters:
base64EncodedStr
- Input ase64 encoded string.- Returns:
- byte [].
-
unixTimeToRFC3339Format
Method to convert from Unix time (seconds from epoch) format to RFC3339 format 1970-05-23T21:21:18.18Z- Parameters:
secondsFromEpoch
- Unix time (seconds from epoch)- Returns:
- RFC3339 format 1970-05-23T21:21:18.18Z as String
-
rfc3339FormatToUnixTime
Method to convert from RFC3339 format 1970-05-23T21:21:18.18Z to Unix time (seconds from epoch) format.- Parameters:
rfc3339DateStr
- RFC3339 format 1970-05-23T21:21:18.18Z as String- Returns:
- Unix time (seconds from epoch)
-