我一直在研究使用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();
}
不知道是什么导致了崩溃。有什么建议吗?