Package ch.bailu.gtk.lib.util
Class JavaResource
java.lang.Object
ch.bailu.gtk.lib.util.JavaResource
Util class for location-independent access to program specific resources.
To read files from "resources/" or from the applications jar archive
-
Constructor Summary
ConstructorDescriptionJavaResource
(String path) Creates a JavaResource object holding a relative path to a file in "resources/" or the root directory of the jar archive -
Method Summary
-
Constructor Details
-
JavaResource
Creates a JavaResource object holding a relative path to a file in "resources/" or the root directory of the jar archive- Parameters:
path
- absolute path to css resource: "/css/app.css"
-
-
Method Details
-
asString
Read entire text resource into string- Returns:
- String containing the entire text resource
- Throws:
IOException
- If file does not exist
-
asStream
Open the program specific resource file and return it as a readable stream- Returns:
- InputStream for reading resource file
- Throws:
IOException
- If file does not exist
-
asBytes
- Throws:
IOException
-