Here you can find the source of createWriter(Socket socket)
public static PrintWriter createWriter(Socket socket) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.PrintWriter; import java.io.OutputStreamWriter; import java.net.Socket; public class Main { public static PrintWriter createWriter(Socket socket) throws IOException { return new PrintWriter(socket.getOutputStream()); }//from ww w . j a va 2 s. c o m public static PrintWriter createWriter(Socket socket, String charset) throws IOException { OutputStreamWriter osw = new OutputStreamWriter(socket.getOutputStream(), charset); return new PrintWriter(osw); } }