public static void writeStringToFile ( File file , String data , String charset ) throws IOException { FileOutputStream fos = openOutputStream ( file , false ) ; fos . write ( data . getBytes ( charset ) ) ; fos . close ( ) ; }
Writes a String to a file creating the file if it does not exist .