title: Preferred way to use Java ZipOutputStream and BufferedOutputStream
body: <p>In Java does it matter whether I instantiate a <a href="http://docs.oracle.com/javase/8/docs/api/java/util/zip/ZipOutputStream.html">ZipOutputStream</a> first, or the <a href="http://docs.oracle.com/javase/8/docs/api/java/io/BufferedOutputStream.html">BufferedOutputStream</a> first? Example:</p>
  
  <pre><code>FileOutputStream dest = new FileOutputStream(file);
  ZipOutputStream zip = new ZipOutputStream(new BufferedOutputStream(dest));
  
  // use zip output stream to write to
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>FileOutputStream dest = new FileOutputStream(file);
  BufferedOutputStream out = new BufferedOutputStream(new ZipOutputStream(dest));
  
  // use buffered stream to write to
  </code></pre>
  
  <p>In my non-scientific timings I can't seem to tell much of a difference here. I can't see anything in the Java API that says if one of these ways is necessary or preferred. Any advice? It seems like compressing the output first and then buffering it for writes would be more efficient.</p>