Code example for HttpEntity

Methods: getContent, getContentEncoding

     *            the entity whose content should be read 
     * @return the input stream to read from 
     * @throws IOException 
    public static InputStream getUngzippedContent(HttpEntity entity) throws IOException {
        InputStream responseStream = entity.getContent();
        if (responseStream == null)
            return responseStream;
        Header header = entity.getContentEncoding();
        if (header == null)
            return responseStream;
        String contentEncoding = header.getValue();
        if (contentEncoding == null)
            return responseStream;
        if (contentEncoding.contains("gzip"))
            responseStream = new GZIPInputStream(responseStream);
        return responseStream;
     * Release resources associated with this client. You must call this, or