Class ResourceFile
java.lang.Object
me.github.simonplays15.betterbansystem.api.files.ResourceFile
ResourceFile represents a utility class for saving and accessing resources within a
data folder.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceFile
(File dataFolder) Constructs a new instance of the ResourceFile class. -
Method Summary
Modifier and TypeMethodDescriptiongetResource
(@NotNull String fileName) Retrieves an InputStream for a given resource file.void
saveResource
(@NotNull String resourcePath, boolean replace) Saves a resource to the specified resource path.
-
Constructor Details
-
ResourceFile
Constructs a new instance of the ResourceFile class.- Parameters:
dataFolder
- The data folder for the resource file.
-
-
Method Details
-
saveResource
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
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.
-