比如两个TXT文件
谢了,各位

解决方案 »

  1.   

    就是从一个文件中读到另一个文件中,然后接着那个文件的结束位置将另一个文件的内容写入,用RandomAccessFile
      

  2.   

    把两个文件都读到缓冲区里,然后先后append的到目标的文件流里
      

  3.   

    把两个文件都读到缓冲区里,然后append的到目标的文件读文件的code如下:
    /* Readfile.java读取文件的内容,并将原样输出至屏幕上使用方法:java Readfile 文件名*/import java.io.*;public class Readfile{public static void main(String[] args){byte[] buff = new byte[1024];boolean cont = true;FileInputStream infile = null;// 生成对象infile 准备读取文件try{infile = new FileInputStream(args[0]);}catch (FileNotFoundException e){System.err.println("没有找到文件");System.exit(1);}while (cont){try{int n = infile.read(buff); // 从文件读取数据System.out.write(buff, 0, n); // 写入System.out中}catch (Exception e){cont = false;} }try{infile.close();}catch (IOException e){System.err.println("文件错误");System.exit(1);}}}