如何解压缩由 PHP gzcompress() 函数压缩的字符串?
有完整的例子吗?
谢谢
我现在这样尝试:
public static String unzipString(String zippedText) throws Exception
{
ByteArrayInputStream bais = new ByteArrayInputStream(zippedText.getBytes("UTF-8"));
GZIPInputStream gzis = new GZIPInputStream(bais);
InputStreamReader reader = new InputStreamReader(gzis);
BufferedReader in = new BufferedReader(reader);
String unzipped = "";
while ((unzipped = in.readLine()) != null)
unzipped+=unzipped;
return unzipped;
}
但如果我试图解压缩 PHP gzcompress (-ed) 字符串,它就不起作用。