1
我一直在研究一個函數,它使用GZIP壓縮字節數組並通過屬於套接字的outputStream發送它。它下載的很好,但是當試圖在我的電腦上解壓時,它說文件已損壞。在java中使用GZIP壓縮字節數組
private void Zip(byte[] datatocompress)
{
ZipOutputStream zippoutstream = new ZipOutputStream(outputstream);
zippoutstream.putNextEntry(new ZipEntry("file.html"));
zippoutstream.write(datatocompress);
zippoutstream.closeEntry();
zippoutstream.flush();
zippoutstream.close();
}
不知道什麼崩潰。任何建議?