package cn.java.study;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
public class Test{
public static void main(String args[]) throws IOException{
StringBuffer buf = new StringBuffer();
char ch;
File file = new File("D:\\1.txt");
InputStream input = new FileInputStream(file);
OutputStream output = new FileOutputStream(file);
byte[] cache = new byte [10240];
while( (ch=(char)input.read(cache))!='\n') {
buf.append(ch);
}
System.out.println(buf);
output.close();
input.close();
}
}
1.txt里写了几句话,但是程序运行后一直读不出来,等了好长时间还在运行,跪求各位大佬指点指点我,感谢感谢