title: Creating large file with BufferedOutputStream takes a long time
body: <p>I have a file which is comprised of one serialized String object written to the start of the file followed by the raw bytes of the file I am attempting to extract.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>FileInputStream fileInputStream = new FileInputStream("C:\Test.tst");
  ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
  String string = (String) objectInputStream.readObject();
  FileOutputStream fileOutputStream = new FileOutputStream("C:\ExtractedTest.tst");
  BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
  while(fileInputStream.available())
  {
    int i = fileInputStream.read();
    bufferedOutputStream.write(i);
  }
  bufferedOutputStream.close();
  fileOutputStream.close();
  </code></pre>
  
  <p>The code takes an unusable long time for large files (1.5 GB, for example). How can I speed up the code? Am I using the wrong classes?</p>
  
  <p>Regards.</p>