我想知道在 gzip 编码响应的情况下我应该做什么。这是处理我的回复的方法:
private InputStream getResultStream(Response response) throws IOException
{
InputStream resultStream = null;
if(response != null)
{
String encoding = response.getHeader("Content-Encoding");
if((encoding != null) && (encoding.equalsIgnoreCase("gzip")))
{
// What to do here ?
Log.d("Stream :", "Read GZIP");
} else if ((encoding != null) && encoding.equalsIgnoreCase("deflate")) {
resultStream = new InflaterInputStream(response.getStream(), new Inflater(true));
Log.d("Stream :", "Read Deflated.");
} else {
resultStream = response.getStream();
Log.d("Stream :","Read Normal.");
}
}
return resultStream;
}
我该如何处理?