I am using following code snippet,
URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setRequestMethod("POST");
MultipartEntityBuilder reqEntity = MultipartEntityBuilder.create();
urlConnection.setRequestProperty("Content-Type", "multipart/form-data; boundary=");
BufferedOutputStream bos = new BufferedOutputStream(urlConnection.getOutputStream());
try {
// reqEntity.writeTo(bos); which method shall I use instead of writeTo();
} finally {
bos.close();
bos.flush();
}
In MultipartEntityBuilder
, there is no method called, writeTo(BufferedOutputStream bos), So instead of that which method shall I used to make it work?
NOTE:
MultipartEntity is deprecated now from Android api-level 23 and above.