Package io.mangoo.utils
Class MangooUtils
- java.lang.Object
-
- io.mangoo.utils.MangooUtils
-
public final class MangooUtils extends Object
- Author:
- svenkubiak
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseQuietly(Closeable closeable)static Map<String,String>copyMap(Map<String,String> originalMap)Copies a given map to a new map instancestatic StringgetVersion()Retrieves the current version of the framework from the version.properties filestatic StringrandomString(int length)Generates a random string with the given length.static StringreadableFileSize(long size)Converts a given file size into a readable file size including unitstatic booleanresourceExists(String name)Checks if a resource exists in the classpath
-
-
-
Method Detail
-
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- Parameters:
length- The length of the random string- Returns:
- A random String
-
closeQuietly
public static void closeQuietly(Closeable 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
-
-