Here you can find the source of writefile(String path, String content, boolean append)
public static void writefile(String path, String content, boolean append)
//package com.java2s; /**/*from w w w. ja va 2s . com*/ * Copyright © 2012-2013 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; public class Main { public static void writefile(String path, String content, boolean append) { BufferedWriter bw; File targetFile; try { targetFile = new File(path); if (targetFile.exists() == false) { targetFile.createNewFile(); } FileWriter fw = new FileWriter(targetFile, append); bw = new BufferedWriter(fw); bw.write(content + "\n"); bw.flush(); bw.close(); } catch (Exception d) { System.out.println(d.getMessage()); } } }