I have InputStream as input (it's a big .zip) which contains several files like:
- xxx1.xml
- xxx2.xml
- xxx2_old.xml
First I need to determine a file I want to process (Lexicographic order) like:
String getFileName(List<String> filenames){
return filenames.stream()
.filter(PREDICATE)
.max(Comparator.naturalOrder());
}
}
Then I need to pass this .xml file as InputStream for further parsing.
It would be easy to operate on objects in memory, but I don't know how to approach this with InputStream. The solution should be memory efficient so I cannot just save everything. Should I read it 2 times?