Name: gm110360 Date: 10/16/2001
J:\Learn\java\Experiment>java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
Create a zip file.
Add some comments to some entries.
Open that file using the following code.
The output contains..
J:\Learn\java\Experiment>java DisplayZip jk.zip
Opening a zip file
Allocating ZIP comments array
Added ZIP comment "J:\Learn\SNMP\Beansexample.class"
Zip file created
Zip file has entries
Where "Allocating ZIP comments array" and the
next line "Added ZIP Comment..." are unwanted.
============= Java Source Follows ======================
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class DisplayZip
{
public static void main(String args[])
{
try
{
System.out.println("Opening a zip file");
ZipFile zf = new ZipFile(args[0]);
System.out.println("Zip file created");
Enumeration e = zf.entries();
System.out.println("Zip file has entries");
while (e.hasMoreElements())
{
ZipEntry ze = (ZipEntry) e.nextElement();
System.out.println("Entry : " + ze.toString());
System.out.println(" Name : " + ze.getName());
System.out.println(" CRC : " + ze.getCrc());
System.out.println(" Is Dir : " + ze.isDirectory
());
System.out.println(" Comment: " + ze.getComment
());
System.out.println(" Method : " + ze.getMethod
());
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
(Review ID: 133863)
======================================================================
- duplicates
-
JDK-4394754 Zip native methods send diagnostic output to console
-
- Closed
-