读取zip文件信息

可以用于读取上传的zip文件信息

// ZipFile zf;
        try {
       // zf = new ZipFile(file);
        FileInputStream in = new FileInputStream(file);
        ZipInputStream zin = new ZipInputStream(in);  
        ZipEntry ze;while ((ze = zin.getNextEntry()) != null) {  
             if (ze.isDirectory()) {
             } else {  
                String name = ze.getName();
                logger.error("file - " + name + " : "  
                         + ze.getSize() + " bytes");  
                 ze.getName();continue;
             }  
         }  
         zin.closeEntry();  
         in.close();
         zin.close();
        } catch (IOException e) {
            e.printStackTrace();
        }  

 

posted @ 2017-11-02 13:43  情似雨餘黏地絮  阅读(240)  评论(0编辑  收藏  举报