Code example for HttpEntity

Methods: getContentgetContentEncoding

     *            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;
Experience pair programming with AI  Get Codota for Java