URLConnection: getContentEncoding() : URLConnection « java.net « Java by API






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);
    }
  }
}

           
         
  








Related examples in the same category

1.URLConnection: connect() throws IOException
2.URLConnection: getContentType()
3.URLConnection: getExpiration()
4.URLConnection: getHeaderFields()
5.URLConnection: getHeaderField(int n)
6.URLConnection: getHeaderFieldKey(int n)
7.URLConnection: getInputStream()
8.URLConnection: getIfModifiedSince()
9.URLConnection: getLastModified()
10.URLConnection: getURL()
11.URLConnection: setAllowUserInteraction(boolean allowuserinteraction)
12.URLConnection: setDoInput(boolean doinput)
13.URLConnection: setDoOutput(boolean dooutput)
14.URLConnection: setIfModifiedSince(long ifmodifiedsince)
15.URLConnection: setRequestProperty(String key, String value)
16.URLConnection: setUseCaches(boolean usecaches)