-
Notifications
You must be signed in to change notification settings - Fork 145
Resource APIs
Rajesh R edited this page Jun 16, 2024
·
1 revision
Confused by the various ways to load resources in Java? Worry no more:
val resource : InputStream = Resource.getAsStream("foo.txt") //Same as this.getClass().getResource("foo.txt")
val resourceURL : java.net.URL = Resource.getUrl("foo.txt")
val rootResourceURL : java.net.URL = Resource.getUrl()
val resourceAsStr : String = Resource.getAsString("foo.txt")
The above APIs can load from custom ClassLoader
s too:
val resource : InputStream = Resource.at[MyClass].getAsStream("foo.txt")