I have a set of files (a.txt, b.txt, c.txt, ....) in a java package along with code. I can access one of these using the getResourceAsStream method. However, I want to get a list of these resources, using a regular expression to find all resources that satisfy *.txt

This needs to work whether the .class and *.txt files are on disk or in a jar file.

Seems like something the reflection api or the Package api should do, but I can't find a way.