Package io.mangoo.utils
Class MangooUtils
java.lang.Object
io.mangoo.utils.MangooUtils
- Author:
- svenkubiak
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(Closeable closeable) Closes a closeable without throwing an exceptionCopies a given map to a new map instancestatic StringRetrieves 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 Details
-
getVersion
Retrieves the current version of the framework from the version.properties file- Returns:
- Current mangoo I/O version
-
copyMap
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
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
Closes a closeable without throwing an exception- Parameters:
closeable- The closeable
-
readableFileSize
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
Checks if a resource exists in the classpath- Parameters:
name- The name of the resource- Returns:
- True if the resources exists, false otherwise
-