Package pl.poznan.put.utility
Class ResourcesHelper
java.lang.Object
pl.poznan.put.utility.ResourcesHelper
A collection of methods to work with resources (src/main/resources/).
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringloadResource(String resource) Load contents of a resource file available in the JAR of running process.static FileloadResourceFile(String resource) Translate resource address to a URI and then to File instance.static URIloadResourceUri(String resource) Translate resource address to a URI.
-
Method Details
-
loadResource
Load contents of a resource file available in the JAR of running process.- Parameters:
resource- Name of the resource.- Returns:
- Contents of the file addressed by the resource name.
- Throws:
IOException- If the file cannot be converted toString
-
loadResourceFile
Translate resource address to a URI and then to File instance.- Parameters:
resource- Name of the resource.- Returns:
- The path to the resource.
- Throws:
URISyntaxException- If the resource URI could not be created.
-
loadResourceUri
Translate resource address to a URI.- Parameters:
resource- Name of the resource.- Returns:
- URI of the resource.
- Throws:
URISyntaxException- If the resource URI could not be created.
-