Code example for URLConnection

Methods: getContentEncoding, getInputStream

0
            } 
        } 
    } 
 
    private static TrackingInputStream getInputStream(URLConnection conn) throws IOException {
        String encoding = conn.getContentEncoding();
        if (encoding != null && encoding.equalsIgnoreCase("gzip")) {
        	return new TrackingGZIPInputStream(new ExposedGZIPInputStream(conn.getInputStream()));
        } 
        return new TrackingHTTPInputStream(conn.getInputStream());
    } 
 
    // always verify the host - don't check for certificate 
    private static final HostnameVerifier DO_NOT_VERIFY = new HostnameVerifier() {
        public boolean verify(String hostname, SSLSession session) { 
            return true; 
        } 
    }; 
    // Create a trust manager that does not validate certificate chains 
    private static final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {