Java tutorial
//package com.java2s; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; public class Main { public static void writeLine(OutputStream os, PrintWriter logWriter, String value) throws IOException { String line = value + "\n"; os.write(line.getBytes()); if (logWriter != null) { logWriter.println(value); } } }