import java.io.*;public class Test {
File fileOut;
BufferedWriter bWrite; public Test() {
} public void writeFile() {
fileOut = new File("c:/111.txt");
String value = "我们都有一个家,名字叫中国!";
try {
bWrite = new BufferedWriter(new FileWriter(fileOut));
}
catch (IOException ex2) {
}
try {
bWrite.write(value);
bWrite.flush();
}
catch (IOException ex1) {
System.out.println(ex1.toString());
}
} public static void main(String[] args) {
new Test().writeFile();
}
}
File fileOut;
BufferedWriter bWrite; public Test() {
} public void writeFile() {
fileOut = new File("c:/111.txt");
String value = "我们都有一个家,名字叫中国!";
try {
bWrite = new BufferedWriter(new FileWriter(fileOut));
}
catch (IOException ex2) {
}
try {
bWrite.write(value);
bWrite.flush();
}
catch (IOException ex1) {
System.out.println(ex1.toString());
}
} public static void main(String[] args) {
new Test().writeFile();
}
}
应该用面向字符的流Writer,就像楼上那样~~
DataOutputStream dout = new DataOutputStream(new FileOutputStream(saveTo));
dout.writeChars(allMessages);
dout.close();??????
??????
??????
??????
??????
??????
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
??????dsfds
保存的TextArea的内容,
是不是这个有关?