/**<br /> * @param path檔案地址<br /> * @param append是否追加<br /> * @param value寫入值<br /> * @param charsetName字元集名稱eg:[gb2312]<br /> * @throws IOException<br /> */<br />public static void writerLine(String path,boolean append,String value,String charsetName) throws IOException<br />{<br />OutputStreamWriter osw=null;<br />BufferedWriter bw=null;<br />try {<br />osw=new OutputStreamWriter(new FileOutputStream(path,append),charsetName);<br />bw=new BufferedWriter(osw);<br />bw.write(new Date().toLocaleString()+value);<br />bw.newLine();<br />bw.flush();<br />} catch (UnsupportedEncodingException e) {<br />System.out.println("沒有指定的字元集");<br />e.printStackTrace();<br />} catch (FileNotFoundException e) {<br />System.out.println("沒有指定的檔案");<br />e.printStackTrace();<br />} catch (IOException e) {<br />e.printStackTrace();<br />throw new IOException("IOException");<br />}<br />finally<br />{<br />bw.close();<br />osw.close();<br />}<br />}