Code example for ZipFile

Methods: entries

0
     * @throws ZipException 压缩文件格式有误时抛出 
     * @throws IOException IO操作有误时抛出 
     */ 
    public static Enumeration<?> getEntriesEnumeration(File zipFile) throws ZipException,
            IOException { 
        ZipFile zf = new ZipFile(zipFile);
        return zf.entries();
 
    } 
 
    /** 
     * 取得压缩文件对象的注释 
     *  
     * @param entry 压缩文件对象 
     * @return 压缩文件对象的注释 
     * @throws UnsupportedEncodingException 
     */ 
    public static String getEntryComment(ZipEntry entry) throws UnsupportedEncodingException {
        return new String(entry.getComment().getBytes("GB2312"), "8859_1");
    }