Skip to content

Instantly share code, notes, and snippets.

@masazdream
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save masazdream/9063279 to your computer and use it in GitHub Desktop.

Select an option

Save masazdream/9063279 to your computer and use it in GitHub Desktop.
さくっと使いたくなることある。
/**
* 指定したStringBuilderをファイルに書き出す
*
* @param filePath
* @param sb
*/
public static void outputFile(String filePath, StringBuilder sb) {
try {
FileWriter fw = new FileWriter(filePath, false);
PrintWriter pw = new PrintWriter(new BufferedWriter(fw));
pw.print(sb.toString());
pw.close();
} catch (IOException e) {
System.out.println("[error]" + filePath + ", " + e.getMessage());
}
System.out.println("[file output finish]" + filePath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment