ZipOutputStream zipOut = new ZipOutputStream(fos);
ZipEntry zipEntry = new ZipEntry("text.txt");
zipOut.putNextEntry(zipEntry);
zipOut.write("你好世界".getBytes("utf-8"));
zipOut.close();
这里需要手动关闭 stream,不要使用 Closeable 接口自动关闭,要最优先关闭,不手动关闭可能会产生 zip end header not found 问题,该问题主要由于stream不完整导致。