Class ResourceManager

java.lang.Object
com.avrix.plugin.ResourceManager

public class ResourceManager extends Object
Manages resources such as images, including caching and encoding utilities.
  • Field Details

    • cachePath

      public static Path 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

      public static String encodeFileName(String fileName)
      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

      public static String getFileExtension(String fileName)
      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

      public static String removeFileExtension(String fileName)
      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

      public static long getFolderSize(File folder)
      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

      public static void deleteFolderContents(File folder)
      Deletes all contents of a folder, including subfolders and files.
      Parameters:
      folder - The folder whose contents are to be deleted.