public static void writeTextFile ( String text , File file ) throws IOException { Writer writer = null ; try { //create writer to file (with default encoding) OutputStream outputStream = new FileOutputStream ( file ) ; writer = IOHelper . createWriter ( outputStream , null ) ; //write to file writer . write ( text ) ; } finally { //close writer IOHelper . closeResource ( writer ) ; } }
Writes the text to the file .