Example usage for java.util.zip ZipFile getComment

List of usage examples for java.util.zip ZipFile getComment

Introduction

In this page you can find the example usage for java.util.zip ZipFile getComment.

Prototype

public String getComment() 

Source Link

Document

Returns the zip file comment, or null if none.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    ZipFile zipFile = new ZipFile(new File("testfile.zip"), ZipFile.OPEN_READ);
    System.out.println(zipFile.getComment());
    Enumeration zipEntries = zipFile.entries();

    while (zipEntries.hasMoreElements()) {
        System.out.println(((ZipEntry) zipEntries.nextElement()).getName());
    }//from  w  ww.  j ava  2 s .  com
}

From source file:org.digidoc4j.impl.BDocContainerTest.java

@Test
public void zipFileComment() throws Exception {
    BDocContainer container = new BDocContainer();
    container.addDataFile("testFiles/test.txt", "text/plain");
    container.sign(PKCS12_SIGNER);/*from w  ww . j  a v a  2  s  .  com*/
    container.save("testZipFileComment.bdoc");

    ZipFile zipFile = new ZipFile("testZipFileComment.bdoc");
    String expectedComment = Helper.createUserAgent(container);
    assertEquals(expectedComment, zipFile.getComment());
}