File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed
src/main/java/org/codehaus/plexus/util Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -464,23 +464,14 @@ public static void fileWrite( File file, String data )
464464 public static void fileWrite ( File file , String encoding , String data )
465465 throws IOException
466466 {
467- try ( Writer writer = getOutputStreamWriter ( file , encoding ) )
468- {
469- writer .write ( data );
470- }
467+ fileWrite ( file .toPath (), encoding , data );
471468 }
472-
473- private static OutputStreamWriter getOutputStreamWriter ( File file , String encoding ) throws IOException
469+
470+ private static void fileWrite ( Path path , String encoding , String data )
471+ throws IOException
474472 {
475- OutputStream out = Files .newOutputStream ( file .toPath () );
476- if ( encoding != null )
477- {
478- return new OutputStreamWriter ( out , encoding );
479- }
480- else
481- {
482- return new OutputStreamWriter ( out );
483- }
473+ byte [] bytes = encoding != null ? data .getBytes ( encoding ) : data .getBytes ();
474+ Files .write ( path , bytes );
484475 }
485476
486477 /**
You can’t perform that action at this time.
0 commit comments