Here you can find the source of writeOutputStream(Socket socket, StringBuffer sb)
public static void writeOutputStream(Socket socket, StringBuffer sb) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.Socket; public class Main { public static void writeOutputStream(Socket socket, StringBuffer sb) throws IOException { PrintWriter writer = getPrintWriterFromOutputStream(socket); writer.write(sb.toString());// w ww. ja v a2 s . c o m writer.flush(); } private static PrintWriter getPrintWriterFromOutputStream(Socket socket) throws IOException { return new PrintWriter(socket.getOutputStream()); } }