import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
public class AAA {
public static void main(String[] args) {
out();
in();
}
private static void out() {
File f = new File("E:\\\\YS\\\\11.txt");
try {
//调用字符流输出方法
Writer out = new FileWriter(f,true);
//输出内容
out.write("嗨害嗨");
//关闭流
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void in() {
File f = new File("E:\\\\YS\\\\11.txt");
try {
Reader in = new FileReader(f);
StringBuilder buf = new StringBuilder();
char[] cs = new char[1];
int len = -1;
while ((len = in.read(cs))!=-1) {
buf.append(new String(cs,0,len));
}
System.out.println(buf);
in.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
01-14
03-09
05-02
1408
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交