Class ExternalResource

java.lang.Object
com.jackmeng.halcyoninae.halcyon.utils.ExternalResource

public class ExternalResource extends Object
ResourceFolder is a general class that holds information about the external resource folder.

The resource folder is named under the name "halcyon-mp4j".

Since:
2.1
Author:
Jack Meng
  • Field Details

    • pm

      public static final PropertiesManager pm
      Represents the global instance of the PropertiesManager for the user-modifiable "halcyon.properties" file

      The program has one global instance to reduce overhead.

  • Constructor Details

    • ExternalResource

      private ExternalResource()
  • Method Details

    • getRandomString

      public static String getRandomString(int length)
      An internal method used to retrieve a random string of letters based on the parameterized length.
      Parameters:
      length - The length of the random string
      Returns:
      String The random string
    • checkResourceFolder

      public static void checkResourceFolder(String folderName)
      Based on provided folders it checks if these subfolders exists from within the main resource folder.

      If a folder does not exist, it will be created under the main resource folder.

      3.0: Changed to have a parameter being taken

      Parameters:
      folderName - The folder to be checked
    • writeLog

      public static void writeLog(String folderName, String f)
      This is a standard method to write a log file to the resource's log folder.

      This can be used for anything, however is not a place for things that are cached to be written to.

      It will only write String based files to the files.

      Parameters:
      folderName - The name of the folder to write to
      f - The file to write
    • writeBufferedImageCacheFile

      public static String writeBufferedImageCacheFile(BufferedImage bi, String cacheFolder, String fileName)
      Writes a buffered-image to the resource folder.

      Planned: - Make it so that it will write to the "cache" folder of the main resource folder.

      Parameters:
      bi - The buffered image to write
      Returns:
      String the absolute path of the image
    • createFolder

      public static boolean createFolder(String name)
      Creates a folder in the standard external resource folder.
      Parameters:
      name - The name of the folder (can be a subdirectory)
      Returns:
      File The folder that was created
    • cacheFile

      public static boolean cacheFile(String fileName, String[] content)
      Creates a cache file in the standard usr folder that is for this program.
      Parameters:
      fileName - The file to be created, just file name.
      content - The contents of the file as a varargs of Objects
      Returns:
      (true | | false) depending on if the creation process was a success or not.
    • getCacheFile

      public static File getCacheFile(String fileName)
      Parameters:
      fileName -
      Returns:
      File
    • dispatchLog

      public static void dispatchLog(Exception... ex)
      Creates a log file with a varargs of exceptions to be logged. This is done asyncronously, however, the user may be alerted.
      Parameters:
      ex - The exceptions to be logged