Class PCMUtils

java.lang.Object
com.portal.pcm.PCMUtils

public class PCMUtils extends Object
Class to host utility methods which can be used by other classes.
  • Constructor Details

    • PCMUtils

      public PCMUtils()
  • Method Details

    • convertBytesToHex

      public static String convertBytesToHex(byte[] bytes)
      Convert input bytes to hex encoded string.
      Parameters:
      bytes - Input byte array.
      Returns:
      Hex encoded string.
    • convertHexToBytes

      public static byte[] convertHexToBytes(String hexString)
      Convert input hex encoded string to bytes.
      Parameters:
      hexString - Hex encoded string.
      Returns:
      Input byte array.
    • convertBytesToBase64

      public static String convertBytesToBase64(byte[] bytes)
      Convert input bytes to Base64 encoded string.
      Parameters:
      bytes - Input byte array.
      Returns:
      base64 encoded string.
    • convertBase64ToBytes

      public static byte[] convertBase64ToBytes(String base64EncodedStr)
      Convert Base64 encoded string to bytes array.
      Parameters:
      base64EncodedStr - Input ase64 encoded string.
      Returns:
      byte [].
    • unixTimeToRFC3339Format

      public static String unixTimeToRFC3339Format(long secondsFromEpoch)
      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

      public static long rfc3339FormatToUnixTime(String rfc3339DateStr)
      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)