因此,我的Java應用程序能夠發現一些使用PHP的gzdeflate()生成的數據。 現在我試圖用Java來誇大這些數據。這是我到目前爲止:Java中的gzinflate
InflaterInputStream inflInstream = new InflaterInputStream(new ByteArrayInputStream(inputData.getBytes()), new Inflater());
byte bytes[] = new byte[1024];
while (true) {
int length = inflInstream.read(bytes, 0, 1024);
if (length == -1) break;
System.out.write(bytes, 0, length);
}
'inputData'是一個包含放縮數據的字符串。
的問題是:儘量不正確頭檢查
在這個問題上的其他網站只能去重新定向:在.read方法拋出一個異常:
java.util.zip.ZipException我到Inflater類的文檔,但顯然我不知道如何使用它來與PHP兼容。
謝謝,這樣做 – 2012-07-09 21:17:36