public static void writeStringToWriter(String string,Writer writer) throws IOException {
  BufferedWriter bw=new BufferedWriter(writer);
  try {
    bw.write(string);
  }
  finally {
    bw.close();
  }
}

public static void writeStringToWriter ( String string , Writer writer ) throws IOException { BufferedWriter bw = new BufferedWriter ( writer ) ; try { bw . write ( string ) ; } finally { bw . close ( ) ; } }
writes given string to given writer . close writer afterwards .
