java.lang.Object
me.github.simonplays15.betterbansystem.api.files.ResourceFile

public class ResourceFile extends Object
ResourceFile represents a utility class for saving and accessing resources within a data folder.
  • Constructor Details

    • ResourceFile

      public ResourceFile (File dataFolder)
      Constructs a new instance of the ResourceFile class.
      Parameters:
      dataFolder - The data folder for the resource file.
  • Method Details

    • saveResource

      public void saveResource (@NotNull @NotNull String resourcePath, boolean replace)
      Saves a resource to the specified resource path.
      Parameters:
      resourcePath - The path of the resource to save.
      replace - Indicates whether to replace the existing file if it already exists.
      Throws:
      NullPointerException - if the resource path is empty or null.
      IllegalArgumentException - if the embedded resource cannot be found.
    • getResource

      public InputStream getResource (@NotNull @NotNull String fileName)
      Retrieves an InputStream for a given resource file.
      Parameters:
      fileName - The name of the resource file.
      Returns:
      An InputStream for the resource file, or null if the resource file was not found.
      Throws:
      RuntimeException - If an error occurs while finding or accessing the resource file.