I have a Jar file that I have created using 3rd party library. When I packaged the jar file, I am including several xml files inside it in a folder named data
data
- file1.xml
- file2.xml
- file3.xml
Now, I wanted to read the folder inside the jar file and as per the documentation of the 3rd party library I could get the classloader and read the folder as inputstream like this.
ClassLoader clsLoader = myService.getClassLoader();
InputStream accountsStream = clsLoader.getResourceAsStream("data");
Question is, how can I list all the files from the inputstream and parse it one by one?
Thanks
EDIT Added Info:
How do I access resources that I put into my service or module archive file?
http://axis.apache.org/axis2/java/core/faq.html#b1
Sorry, the question should have been specific to Apache Axis but I am confused a little bit if it is a Java specific question also.
After getting an inputstream to a folder using the classloader, how do I list all the files into that folder and read it one by one?
The steps in my code would inlcude.
- Get an inputstream into the folder
- List all files from that inputstream
- Read it one by one