I want to read a bunch of text files in com.example.resources package. I can read a single file using the following code:
InputStream is = MyObject.class.get
If you pass in a directory to the getResourceAsStream
method then it will return a listing of files in the directory ( or at least a stream of it).
Thread.currentThread().getContextClassLoader().getResourceAsStream(...)
I purposely used the Thread to get the resource because it will ensure I get the parent class loader. This is important in a Java EE environment however probably not too much for your case.