Package pl.poznan.put.utility
Class ResourcesHelper
- java.lang.Object
-
- pl.poznan.put.utility.ResourcesHelper
-
public final class ResourcesHelper extends Object
A collection of methods to work with resources (src/main/resources/).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
loadResource
public static String loadResource(String resource) throws IOException
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
public static File loadResourceFile(String resource) throws URISyntaxException
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
public static URI loadResourceUri(String resource) throws URISyntaxException
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.
-
-