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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -