Currently, I have a script that loops over System.in for data processing. I am passing data to it from several files with cat.
cat myfiles*.txt | java MyDataProcessor
Based on the idea that cat adds some inefficiency vs. Java opening the files directly, I’d like to optimize this to where Java opens the files directly:
java MyDataProcessor myfiles*.txt
Are there any Java libraries that make this fairly easy (i.e. that handle the translation of posix wildcards into file handlers)?
In case this isn’t obvious to someone, as it wasn’t to me at first, if the files are local, then you can let Posix do the parsing for you, and the files will be passed to
main(String[] args)as arguments. In my case, I had a few other parameters, so just moved the wildcard argument as the last one.