流的读取方式可以从一个文件读出到另外一个文件当中

   byte[] buffer = new byte[1024];
        ZipOutputStream outputStream = new ZipOutputStream(
                new FileOutputStream(target));
        outputStream.putNextEntry(new ZipEntry(source.getName()));
        InputStream inputStream = new FileInputStream(source);
        for (int i = inputStream.read(buffer); i > 0; i = inputStream
                .read(buffer)) {
            outputStream.write(buffer, 0, i);
        }
        inputStream.close();
        outputStream.close();

你可能感兴趣的:(文件)