Class MangooUtils

java.lang.Object
io.mangoo.utils.MangooUtils

public final class MangooUtils extends Object
Author:
svenkubiak
  • Method Details

    • getVersion

      public static String getVersion()
      Retrieves the current version of the framework from the version.properties file
      Returns:
      Current mangoo I/O version
    • copyMap

      public static Map<String,String> copyMap(Map<String,String> originalMap)
      Copies a given map to a new map instance
      Parameters:
      originalMap - The map to copy
      Returns:
      A new Map instance with value from originalMap
    • randomString

      public static String randomString(int length)
      Generates a random string with the given length. Based on commons-lang3 RandomStringUtils using SecureRandom Uses: uppercase letters, lowercase letters and numbers 0-9
      Parameters:
      length - The length of the random string
      Returns:
      A random String
    • closeQuietly

      public static void closeQuietly(Closeable closeable)
      Closes a closeable without throwing an exception
      Parameters:
      closeable - The closeable
    • readableFileSize

      public static String readableFileSize(long size)
      Converts a given file size into a readable file size including unit
      Parameters:
      size - The size in bytes to convert
      Returns:
      Readable files size, e.g. 24 MB
    • resourceExists

      public static boolean resourceExists(String name)
      Checks if a resource exists in the classpath
      Parameters:
      name - The name of the resource
      Returns:
      True if the resources exists, false otherwise