Class ResourceDistributor

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

public class ResourceDistributor extends Object
Retrieves resources from the binary resource folder.

This resource folder is not located externally and is packed in during compilation to the generated binary.

This class should not be confused with ExternalResource as that class handles external resources, while this class handles internal resources.

Since:
2.1
Author:
Jack Meng
  • Constructor Details

    • ResourceDistributor

      public ResourceDistributor()
  • Method Details

    • getFromAsImageIcon

      public ImageIcon getFromAsImageIcon(String path)
      Gets an ImageIcon from the resource folder.
      Parameters:
      path - The path to the image
      Returns:
      ImageIcon The image icon
    • getFromAsFile

      public File getFromAsFile(String path)
      Gets a standard file from the resource folder.
      Parameters:
      path - The path to the file
      Returns:
      File The file
    • getFromAsURL

      public URL getFromAsURL(String path)
      Similar to other methods but returns as URL
      Parameters:
      path -
      Returns:
    • getFromAsStream

      public InputStream getFromAsStream(String path)
      Similar to other methods but returns as InputStream
      Parameters:
      path -
      Returns:
    • getFromAsBufferedImage

      public BufferedImage getFromAsBufferedImage(String path)
      Retrieve a resource as a BufferedImage
      Parameters:
      path - The path to the suspected resource
      Returns:
      The BufferedImage or null if not found