OutputStreamWriter is the preferred file write method as it does not make encoding assumptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (OutputStreamWriter osw = | |
new OutputStreamWriter(new FileOutputStream("/FilePath/Here"), "UTF-8")) { | |
PrintWriter pw = new PrintWriter(osw); | |
pw.write("Hello World");//does not add newline character | |
pw.close(); | |
} catch (IOException e) { | |
e.printstacktrace; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment