URLConnection: getContentEncoding()
import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; public class MainClass { public static void main(String args[]) { try { URL u = new URL("http://www.java2s.com"); URLConnection uc = u.openConnection(); System.out.println("Content-encoding: " + uc.getContentEncoding()); } catch (MalformedURLException e) { System.err.println("not a URL I understand"); } catch (IOException e) { System.err.println(e); } } }