public static void writeCharsToWriter(char[] chars,Writer writer) throws IOException {
  BufferedWriter bw=new BufferedWriter(writer);
  try {
    bw.write(chars);
  }
  finally {
    bw.close();
  }
}

public static void writeCharsToWriter ( char [ ] chars , Writer writer ) throws IOException { BufferedWriter bw = new BufferedWriter ( writer ) ; try { bw . write ( chars ) ; } finally { bw . close ( ) ; } }
writes given chars array to given writer . close writer afterwards .
