Java URL Value Check isCompressed(HttpURLConnection connection)

Here you can find the source of isCompressed(HttpURLConnection connection)

Description

is Compressed

License

LGPL

Declaration

private static boolean isCompressed(HttpURLConnection connection) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.net.HttpURLConnection;

import java.util.List;
import java.util.Map;

public class Main {
    private static boolean isCompressed(HttpURLConnection connection) {
        for (Map.Entry<String, List<String>> entry : connection.getHeaderFields().entrySet()) {
            if ("Content-Encoding".equalsIgnoreCase(entry.getKey())) {
                return "gzip".equalsIgnoreCase(entry.getValue().get(0));
            }//  w ww .  jav  a  2  s.c o m
        }

        return false;
    }
}

Related

  1. invokeUrl(String url)
  2. is200(final String url)
  3. is404(URL url)
  4. isAddressReachable(String url, int timeout)
  5. isAValidURL(String url)
  6. isEMailAddress(URL url)
  7. isFile(final URL url)
  8. isFile(final URL url)
  9. isFile(URL url)