Skip to content

Instantly share code, notes, and snippets.

@mizuneko
Created March 3, 2013 02:49
Show Gist options
  • Save mizuneko/5074264 to your computer and use it in GitHub Desktop.
Save mizuneko/5074264 to your computer and use it in GitHub Desktop.
ファイルへの書き出し
String path = "C:/dir/to/my/file/myfile.txt";
String encoding = "Windows-31j";
// 出力ストリームを開く
PrintWriter writer = new PrintWriter(
new OutputStreamWriter(new FileOutputStream(path), encoding));
// ファイルへ文字列を書き出す
try {
writer.println("This is test.");
writer.println("This is test test.");
writer.println("This is test test test.");
} finally {
try { writer.close(); } catch(Exception e) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment