HttpURLConnection SetChunkedStreamingMode() Example
This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance.
HttpURLConnectionclass SetChunkedStreamingMode() method example. This example shows you how to use SetChunkedStreamingMode() method.This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance.
Here is the code:-
/*
* @Program that is used to enable streaming of a HTTP request body without
internal buffering, when the content length is not known in advance.
* SetChunkedStreamingMode.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class SetChunkedStreamingMode {
public static void main(String[] args) throws Exception {
URL url = new URL("http://192.168.10.211:8080");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//enable streaming of a HTTP request body without internal buffering
connection.setChunkedStreamingMode(1);
System.out.println("HTTP request body without internal buffering is set");
}
} |
Output of the program:-
| HTTP request body without internal buffering is set |
|