Class ResourceUtil
java.lang.Object
org.eclipse.rdf4j.common.io.ResourceUtil
ResourceUtil is a utility class for retrieving resources (images, property-files, etc) from the classpath.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA helper class to get the call context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Class<?> Retrieve the calling class of a method in this class.static InputStreamgetInputStream(String resourceName) Get an inputstream on the specified resource.static PropertiesgetProperties(String resourceName) Retrieve a properties resource.static StringRetrieve the String contents of the specified resource, obtained by opening in inputstream on the resource and then interpreting the bytes contained in the inputstream as if they represented characters.static URLThe URL to the specified resource
-
Constructor Details
-
ResourceUtil
public ResourceUtil()
-
-
Method Details
-
getURL
-
getInputStream
Get an inputstream on the specified resource.- Parameters:
resourceName- the name of the resource- Returns:
- an inputstream on the specified resource, or null if the resource could not be found
-
getString
Retrieve the String contents of the specified resource, obtained by opening in inputstream on the resource and then interpreting the bytes contained in the inputstream as if they represented characters. This may not make sense on all resources. There is no "magic" in this method to read anything other than plain text.- Parameters:
resourceName- the name of the resource- Returns:
- the String contents of the specified resource, or null if the specified resource could not be found
- Throws:
IOException- when something goes wrong trying to read the resource
-
getProperties
Retrieve a properties resource.- Parameters:
resourceName- the name of the resource- Returns:
- a Properties object representing the contents of the resource, or null if the specified resource could not be found
- Throws:
IOException
-
getCaller
Retrieve the calling class of a method in this class.- Returns:
- the calling class of a method in this class, or this class if no other class could be determined.
-