Created
October 20, 2015 12:37
-
-
Save AndrewRussellHayes/f1498cd73d8d26be9017 to your computer and use it in GitHub Desktop.
OutputStreamWriter is the preferred file write method as it does not make encoding assumptions
This file contains hidden or 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