URLConnection getContentEncoding Example
URLConnection class getContentEncoding example. This example shows you how to use getContentEncoding method.
URLConnection class getContentEncoding example. public String getContentEncoding() Returns the value of the content-encoding header field.
Here is the code
/*
* @ # GetContentEncoding.java
* A class repersenting use to GetContentEncoding
* method of URLConnection class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetContentEncoding {
public static void main(String args[]) throws Exception {
SocketAddress socketAddress = new InetSocketAddress("192.168.10.80", 9090);
Proxy proxy = new Proxy(Proxy.Type.HTTP, socketAddress);
URL url = new URL("http://google.com");
URLConnection connection = url.openConnection(proxy);
System.out.println("value of the content-encoding header field" +
connection.getContentEncoding());
}
} |
|