Friday, 23 August 2013

How to programmatically search text in jar file?

How to programmatically search text in jar file?

I want to search my sources.jar for the occurrence of a certain search token.
In Bash, this will extract the jar to a stream and grep for the string:
unzip -p sources.jar | grep $SEARCH_TOKEN
In Java, reading all entries via JarInputStream looks rather tedious. Is
there a better/simpler way (for both, the looping and the grepping)?

No comments:

Post a Comment