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