Here you can find the source of writeToConnection(final HttpURLConnection couchdbConnection, final String content)
public static void writeToConnection(final HttpURLConnection couchdbConnection, final String content)
//package com.java2s; //License from project: Open Source License import java.io.DataOutputStream; import java.io.IOException; import java.net.HttpURLConnection; public class Main { public static void writeToConnection(final HttpURLConnection couchdbConnection, final String content) { try {/*from w ww . ja va 2s. c o m*/ couchdbConnection.setDoOutput(true); final DataOutputStream dataOutputStream = new DataOutputStream(couchdbConnection.getOutputStream()); dataOutputStream.writeBytes(content); dataOutputStream.flush(); dataOutputStream.close(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } public static void writeToConnection(final HttpURLConnection couchdbConnection, final byte[] content) { try { couchdbConnection.setDoOutput(true); final DataOutputStream dataOutputStream = new DataOutputStream(couchdbConnection.getOutputStream()); dataOutputStream.write(content, 0, content.length); dataOutputStream.flush(); dataOutputStream.close(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } }