title: What is the most efficient (fastest) way to concatenate two large (over 1.5GB) files in java?
body: <p>I have utilized the techniques here and concatenated two 1.5GB files in 70 seconds.</p>
  
  <p><a href="http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly" rel="noreferrer">http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly</a></p>
  
  <p>My code involved using FileChannels with memory mapping and ByteBuffers with an 8KB buffer size.</p>
  
  <p>How could I improve this speed?</p>
  
  <pre><code>File file = new File(binDirectory + "/donjon.avi");
  File oFile = new File(binDirectory + "/donjon2.avi");
  
  FileInputStream is = new FileInputStream(file);
  FileOutputStream fos = new FileOutputStream(oFile);
  FileChannel f1 = is.getChannel();
  FileChannel f2 = fos.getChannel();
  
  f2.transferFrom(f1, 0, f1.size());
  f2.transferFrom(f1, f1.size(), f1.size());
  
  f2.close();
  f1.close();
  </code></pre>