title: DataOutputStream() VS DataOutputStream(new BufferedOutputStream())
body: <p>The code at <a href="http://download.oracle.com/javase/tutorial/displayCode.html?code=http://download.oracle.com/javase/tutorial/essential/io/examples/DataStreams.java" rel="noreferrer">Java Tutorials</a> showed an example of using <code>DataOutputStream</code> class and <code>DataInputStream</code> class.</p>
  
  <p>A snippet of the code looks like this:</p>
  
  <pre><code>//..
  out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dataFile)));
  //..
  in = new DataInputStream(new BufferedInputStream(new FileInputStream(dataFile)));
  //..
  </code></pre>
  
  <p>I was wondering why is it required to create a new <code>BufferedOutputStream</code> when we create a new <code>DataOutputStream</code> ?</p>
  
  <p>Isn't it redundant since this alternative works as well? : <code>new DataOutputStream(new FileOutputStream(dataFile));</code></p>
  
  <p>As <a href="http://download.oracle.com/javase/tutorial/essential/io/datastreams.html" rel="noreferrer">this page</a> claims, DataStreams already provides a buffered file output byte stream. So is "double-buffering" really required?</p>
  
  <p>I've modified the 2 lines of code (output and input), taking away the <code>BufferedOutputStream</code> and <code>BufferedInputStream</code> and everything seems to work just fine, so I was wondering what is the purpose of the <code>BufferedOutputStream</code> and <code>BufferedInputStream</code> ?</p>