Package com.avrix.plugin
Class ResourceManager
java.lang.Object
com.avrix.plugin.ResourceManager
Manages resources such as images, including caching and encoding utilities.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clears the cache if it exceeds the maximum allowed size.static void
deleteFolderContents
(File folder) Deletes all contents of a folder, including subfolders and files.static String
encodeFileName
(String fileName) Encodes a file name to a Base64 string.static String
getFileExtension
(String fileName) Retrieves the file extension from a file name.static long
getFolderSize
(File folder) Recursively calculates the size of a folder in bytes.static void
init()
Initializes the resource manager by setting up the cache directory and loading resources.static String
removeFileExtension
(String fileName) Removes the file extension from a file name.
-
Field Details
-
cachePath
The path to the cache directory.
-
-
Constructor Details
-
ResourceManager
public ResourceManager()
-
-
Method Details
-
init
public static void init()Initializes the resource manager by setting up the cache directory and loading resources. -
encodeFileName
Encodes a file name to a Base64 string.- Parameters:
fileName
- The name of the file to encode.- Returns:
- The Base64 encoded string representation of the file name.
-
getFileExtension
Retrieves the file extension from a file name.- Parameters:
fileName
- The name of the file from which to extract the extension.- Returns:
- The file extension in lowercase, or an empty string if there is no extension.
-
removeFileExtension
Removes the file extension from a file name.- Parameters:
fileName
- The name of the file from which to remove the extension.- Returns:
- The file name without the extension, or the original name if no extension exists.
-
clearCache
public static void clearCache()Clears the cache if it exceeds the maximum allowed size. -
getFolderSize
Recursively calculates the size of a folder in bytes.- Parameters:
folder
- The folder whose size is to be calculated.- Returns:
- The total size of the folder in bytes.
-
deleteFolderContents
Deletes all contents of a folder, including subfolders and files.- Parameters:
folder
- The folder whose contents are to be deleted.
-