Is there any way to check if InputStream has been gzipped? Here\'s the code:
public static InputStream decompressStream(InputStream input) {
try {
Not exactly what you are asking but could be an alternative approach if you are using HttpClient:
private static InputStream getInputStream(HttpEntity entity) throws IOException {
Header encoding = entity.getContentEncoding();
if (encoding != null) {
if (encoding.getValue().equals("gzip") || encoding.getValue().equals("zip") || encoding.getValue().equals("application/x-gzip-compressed")) {
return new GZIPInputStream(entity.getContent());
}
}
return entity.getContent();
}