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();
流的读取方式可以从一个文件读出到另外一个文件当中
最新推荐文章于 2023-10-27 10:40:46 发布