URLConnection setDoOutput Example
URLConnection class setDoOutput example. This example shows you how to use setDoOutput method.
URLConnection class setDoOutput example. public void setDoOutput(boolean dooutput) Sets the value of the doOutput field for this URLConnection to the specified value.
Here is the code
/*
* @ # SetDoOutput.java
* A class repersenting use to SetDoOutput method
* of URL class in java.net package
* version 24 June 2008
* author Rose India
*/
import java.net.*;
public class SetDoOutput {
public static void main(String args[]) throws Exception {
SocketAddress address = new InetSocketAddress("192.168.10.80", 9090);
Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
URL url = new URL("http://yahoo.com");
URLConnection connection = url.openConnection(proxy);
System.out.println("doOutput " + connection.getDoOutput());
connection.setDoOutput(true);
System.out.println("doOutput " + connection.getDoOutput());
}
} |
Output
doOutput false
doOutput true |
|