Package play.libs
Class Codec
- java.lang.Object
-
- play.libs.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 valuestatic java.lang.String
encodeBASE64(byte[] value)
Encode binary data to base64static java.lang.String
encodeBASE64(java.lang.String value)
Encode a String to base64static java.lang.String
hexMD5(java.lang.String value)
Build an hexadecimal MD5 hash for a Stringstatic java.lang.String
hexSHA1(java.lang.String value)
Build an hexadecimal SHA1 hash for a Stringstatic byte[]
hexStringToByte(java.lang.String hexString)
Transform an hexadecimal String to a byte array.static java.lang.String
UUID()
Generate an UUID String
-
-
-
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
-
-