解决方案 »

  1.   

    这个是我的解压代码  我的问题是,在大多数手机上执行这段代码都是ok的,可是今天早上HUAWEI C8815手机程序就会出现 zis.read(data, 0, BUFFER)==0的问题 然后程序就卡死了  换个服务器登录试了下又ok了  。然后我又用其他手机试了下那个服务器完全没问题   不知道是HUAWEI C8815手机的问题还是服务器的问题  。。
    我也不会,帮你顶一下
      

  2.   

    卡死???放在main线程执行的?
      

  3.   

    public static void unZipFile(String archive) throws IOException,
    FileNotFoundException, ZipException { archive = CommonUtil.getRootFilePath() + archive;
    String decompressDir = CommonUtil.getRootFilePath();
    BufferedInputStream bi;
    ZipFile zf = new ZipFile(archive, "GBK");
    Enumeration e = zf.getEntries();
    while (e.hasMoreElements()) {
    ZipEntry ze2 = (ZipEntry) e.nextElement();
    String entryName = ze2.getName();
    String path = decompressDir + entryName;
    if (ze2.isDirectory()) {
    // System.out.println("正在创建解压目录 - " + entryName);
    File decompressDirFile = new File(path);
    if (!decompressDirFile.exists()) {
    decompressDirFile.mkdirs();
    }
    } else {
    // System.out.println("正在创建解压文件 - " + entryName);
    String fileDir = path.substring(0, path.lastIndexOf("/"));
    File fileDirFile = new File(fileDir);
    if (!fileDirFile.exists()) { fileDirFile.mkdirs(); }
    BufferedOutputStream bos = new BufferedOutputStream(
    new FileOutputStream(decompressDir + entryName));
    bi = new BufferedInputStream(zf.getInputStream(ze2));
    byte[] readContent = new byte[1024];
    int readCount = bi.read(readContent);
    while (readCount != -1) {
    bos.write(readContent, 0, readCount);
    readCount = bi.read(readContent);
    }
    bos.close();
    }
    }
    zf.close();

    }