Package dev.prozilla.pine.common.system
Class ResourceUtils
java.lang.Object
dev.prozilla.pine.common.system.ResourceUtils
Utility class for handling resources.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getResourcePath
(String path) Finds the resource and returns its normalized path.static InputStream
getResourceStream
(String path) Finds the resource and returns it as an InputStream.
-
Method Details
-
getResourcePath
Finds the resource and returns its normalized path.Searches in the "resources/" folder first, then in the classpath.
- Parameters:
path
- Path to the resource relative to the resources directory- Returns:
- Normalized path to the resource
- Throws:
RuntimeException
- If the resource was not found
-
getResourceStream
Finds the resource and returns it as an InputStream.Searches in the "resources/" folder first, then in the classpath.
- Parameters:
path
- Path to the resource relative to the resources directory- Returns:
- InputStream of the resource
- Throws:
RuntimeException
- If the resource was not found or cannot be opened
-