byte[] bBytes = new byte[102400];
      FileInputStream infile = new FileInputStream(a);
      FileOutputStream outfile = new FileOutputStream(b);
      int nRead ;
      while ((nRead = infile.read(bBytes, 0, 102400)) > 0) {
        outfile.write(bBytes,0,nRead);
      }
      infile.close();
      outfile.close();

解决方案 »

  1.   

    RandomAccessFile fin = new RandomAccessFile("matchTable.dat","r"); 
    long filePoint = 0;//文件指针
    long fileLength = fin.length();//获得文件的长度
    while(filePoint < fileLength) {//指针小于文件的长度,则不到文件结尾
      System.out.println(fin.readLine());
      filePoint = fin.getFilePointer();//读过文件内容后得到当前指针的位置
    }
      

  2.   

    int bytes_read;
    byte[] buffer = new byte[4096];         // To hold file contents
    while((bytes_read = fin.read(buffer)) != -1)断是否已经读到文件结尾了