Class Utils


  • public class Utils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String base64Encode​(java.lang.String data)
      Encode the given string with Base64
      static java.lang.String hexStringify​(byte[] data)
      Convert a byte array to its hex-string
      static boolean isSyncEnabled​(org.gradle.api.Project project)  
      static byte[] sha256Hash​(byte[] data)
      Compute the SHA-256 hash of the given byte array
      • Methods inherited from class java.lang.Object

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

      • Utils

        public Utils()
    • Method Detail

      • base64Encode

        public static java.lang.String base64Encode​(java.lang.String data)
                                             throws java.io.UnsupportedEncodingException
        Encode the given string with Base64
        Parameters:
        data - the string to encode
        Returns:
        the encoded string
        Throws:
        java.io.UnsupportedEncodingException - if string is not valid utf8
      • sha256Hash

        public static byte[] sha256Hash​(byte[] data)
                                 throws java.security.NoSuchAlgorithmException
        Compute the SHA-256 hash of the given byte array
        Parameters:
        data - the byte array to hash
        Returns:
        the hashed byte array
        Throws:
        java.security.NoSuchAlgorithmException
      • hexStringify

        public static java.lang.String hexStringify​(byte[] data)
        Convert a byte array to its hex-string
        Parameters:
        data - the byte array to convert
        Returns:
        the hex-string of the byte array
      • isSyncEnabled

        public static boolean isSyncEnabled​(org.gradle.api.Project project)