本帖最后由 23559768 于 2013-1-17 21:49 编辑
bufferedReader Readline的方法· 读文件的时候· 如果文件最后一行没有换行· 即使读到啦也会返回空的的问题怎么解决啊
读到的文件总是小一点·
public void copy(File src, File target) {
System.out.println("woxie");
BufferedReader bufr = null;
BufferedWriter bufw = null;
try {
bufr = new BufferedReader(new FileReader(src));
bufw = new BufferedWriter(new FileWriter(target));
String line = null;
while((line = bufr.readLine()) != null) {
bufw.write(line);
bufw.newLine();
bufw.flush();
}
|