Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 压缩Pcap文件时出现的问题_Java_Android - Fatal编程技术网

Java 压缩Pcap文件时出现的问题

Java 压缩Pcap文件时出现的问题,java,android,Java,Android,我正在生成pcap文件,需要压缩它。目前,我能够生成pcap文件并将其存储在本地存储器中 对于压缩,我使用以下代码: @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... urls) { byte[] buffer = new byte[1024]; try { zipFil

我正在生成pcap文件,需要压缩它。目前,我能够生成pcap文件并将其存储在本地存储器中
对于压缩,我使用以下代码:

@Override
protected void onPreExecute() {
    super.onPreExecute();
}

@Override
protected String doInBackground(String... urls) {
    byte[] buffer = new byte[1024];
    try {
        zipFilePath = urls[0];
        FileOutputStream fos = new FileOutputStream(zipFilePath + ".zip");
        ZipOutputStream zos = new ZipOutputStream(fos);
        ZipEntry ze = new ZipEntry(urls[1]);
        zos.putNextEntry(ze);
        FileInputStream in = new FileInputStream(zipFilePath);

        int len;
        while ((len = in.read(buffer)) > 0) {
            zos.write(buffer, 0, len);
        }
        in.close();
        zos.closeEntry();
        //remember close it
        zos.close();
        return zipFilePath + ".zip";
    } catch (IOException ex) {
        ex.printStackTrace();
        return "";
    }
}
我在
FileOutputStream fos=newfileoutputstream(zipFilePath+“.zip”)处发现
filenotfound
异常