Java code - number of files in a JAR -
i want find number of files jar contains. there way without looping through this:
while (enumentries.hasmoreelements()) { enumentries.nextelement(); count++; }
i want have number of files before loop through entries. seems not elegant loop through them twice.
you can use size() count number of entries that's loop return.
uses
jarfile f = new jarfile(new file("path.jar")); system.out.println(f.size());
Comments
Post a Comment