Source Code : JAR Archives: Jar Lister
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
JAR Archives: Jar Lister
import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
public class Main {
public static void main(String[] args) throws IOException {
JarFile jf = new JarFile("a.jar");
Enumeration e = jf.entries();
while (e.hasMoreElements()) {
JarEntry je = (JarEntry) e.nextElement();
System.out.println(je.getName());
long uncompressedSize = je.getSize();
long compressedSize = je.getCompressedSize();
long crc = je.getCrc();
int method = je.getMethod();
String comment = je.getComment();
System.out.println(new Date(je.getTime()));
System.out.println("from " + uncompressedSize + " bytes to "+ compressedSize);
if (method == ZipEntry.STORED) {
System.out.println("ZipEntry.STORED");
}
else if (method == ZipEntry.DEFLATED) {
System.out.println(ZipEntry.DEFLATED);
}
System.out.println("Its CRC is " + crc);
System.out.println(comment);
System.out.println(je.isDirectory());
Attributes a = je.getAttributes();
if (a != null) {
Object[] nameValuePairs = a.entrySet().toArray();
for (int j = 0; j < nameValuePairs.length; j++) {
System.out.println(nameValuePairs[j]);
}
}
System.out.println();
}
}
}
Thank with us