public static void write ( CharSequence content , File file , String encoding ) { OutputStream os = null ; try { os = new FileOutputStream ( file ) ; PrintWriter printWriter = new PrintWriter ( new OutputStreamWriter ( os , encoding ) ) ; printWriter . print ( content ) ; printWriter . flush ( ) ; os . flush ( ) ; } catch ( IOException e ) { throw E . unexpected ( e ) ; } finally { close ( os ) ; } }
Write String content to a file with encoding specified