Package play.libs

Class Codec


  • public class Codec
    extends java.lang.Object
    Codec utils
    • Constructor Summary

      Constructors 
      Constructor Description
      Codec()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String byteToHexString​(byte[] bytes)
      Write a byte array as hexadecimal String.
      static byte[] decodeBASE64​(java.lang.String value)
      Decode a base64 value
      static java.lang.String encodeBASE64​(byte[] value)
      Encode binary data to base64
      static java.lang.String encodeBASE64​(java.lang.String value)
      Encode a String to base64
      static java.lang.String hexMD5​(java.lang.String value)
      Build an hexadecimal MD5 hash for a String
      static java.lang.String hexSHA1​(java.lang.String value)
      Build an hexadecimal SHA1 hash for a String
      static byte[] hexStringToByte​(java.lang.String hexString)
      Transform an hexadecimal String to a byte array.
      static java.lang.String UUID()
      Generate an UUID String
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Codec

        public Codec()
    • Method Detail

      • UUID

        public static java.lang.String UUID()
        Generate an UUID String
        Returns:
        an UUID String
      • encodeBASE64

        public static java.lang.String encodeBASE64​(java.lang.String value)
        Encode a String to base64
        Parameters:
        value - The plain String
        Returns:
        The base64 encoded String
      • encodeBASE64

        public static java.lang.String encodeBASE64​(byte[] value)
        Encode binary data to base64
        Parameters:
        value - The binary data
        Returns:
        The base64 encoded String
      • decodeBASE64

        public static byte[] decodeBASE64​(java.lang.String value)
        Decode a base64 value
        Parameters:
        value - The base64 encoded String
        Returns:
        decoded binary data
      • hexMD5

        public static java.lang.String hexMD5​(java.lang.String value)
        Build an hexadecimal MD5 hash for a String
        Parameters:
        value - The String to hash
        Returns:
        An hexadecimal Hash
      • hexSHA1

        public static java.lang.String hexSHA1​(java.lang.String value)
        Build an hexadecimal SHA1 hash for a String
        Parameters:
        value - The String to hash
        Returns:
        An hexadecimal Hash
      • byteToHexString

        public static java.lang.String byteToHexString​(byte[] bytes)
        Write a byte array as hexadecimal String.
        Parameters:
        bytes - byte array
        Returns:
        The hexadecimal String
      • hexStringToByte

        public static byte[] hexStringToByte​(java.lang.String hexString)
        Transform an hexadecimal String to a byte array.
        Parameters:
        hexString - Hexadecimal string to transform
        Returns:
        The byte array