我用一下程序写入一个文件,在 前面会随机出现一个或者2个字母,为什么会这样啊,谢谢 DataOutputStream output1 = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(filepath1)));
output1.writeUTF("<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>"+content); output1.flush();
output1.writeUTF("<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>"+content); output1.flush();
File f = new File(path+"/a.txt");
FileOutputStream s = new FileOutputStream(f);
OutputStreamWriter o = new OutputStreamWriter(s,"utf-8");
BufferedWriter output = new BufferedWriter(o);
output.write("<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>");
output.close();
o.close();
o.close();
s.flush();
s.close(); } catch (Exception e) {
e.printStackTrace();
}