ZipEntry: getComment() : ZipEntry « java.util.zip « Java by API






ZipEntry: getComment()

 
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class Main {
  public static void main(String[] args) throws Exception {
    ZipFile zf = new ZipFile("your.zip");
    Enumeration e = zf.entries();
    while (e.hasMoreElements()) {
      ZipEntry ze = (ZipEntry) e.nextElement();
      String name = ze.getName();

      long crc = ze.getCrc();
      System.out.println("Its CRC is " + crc);

      String comment = ze.getComment();
      if (comment != null && !comment.equals("")) {
        System.out.println(comment);
      }
      if (ze.isDirectory()) {
        System.out.println(name + " is a directory");
      }
    }
  }
}

   
  








Related examples in the same category

1.ZipEntry.DEFLATED
2.ZipEntry.STORED
3.new ZipEntry(String name)
4.ZipEntry: getCompressedSize()
5.ZipEntry: getCrc()
6.ZipEntry: getName()
7.ZipEntry: getSize()
8.ZipEntry: getTime()
9.ZipEntry: isDirectory()