KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List<String> getResourceNames (String directoryName) . For example, given a classpath directory x/y/z containing files a.html , b.html , c.html and a subdirectory d , getResourceNames("x/y/z") should return a List<String> containing the following strings: ['a.html', 'b.html', 'c.html', 'd'] . It should work both for resources in filesystem and jars. I know that I can write a quick snippet with File s, JarFile s and URL s, but I do not want to reinvent the wheel. My question is, given existing publicly available libraries, what is the quickest way to implement getResourceNames ? Spring and Apache Commons stacks are both feasible.
Tags (comma-separated)
Save Edits
Cancel