Here you can find the source of writeBody(HttpURLConnection connection, String body)
private static void writeBody(HttpURLConnection connection, String body) throws Exception
//package com.java2s; //License from project: LGPL import java.io.OutputStream; import java.net.HttpURLConnection; public class Main { private static void writeBody(HttpURLConnection connection, String body) throws Exception { OutputStream stream = connection.getOutputStream(); stream.write(body.getBytes());// w w w . j a v a2s .co m stream.flush(); stream.close(); } }