code: private void copy(final InputStream inputStream, final FileOutputStream outputStream) throws IOException {
          final byte[] buffer = new byte[1024*4];
          int n;
          try {
              while (-1 != (n = inputStream.read(buffer))) {
                  outputStream.write(buffer, 0, n);
              }
          } finally {
              inputStream.close();
              outputStream.close();
          }
      }
docs: Copies the input stream to the output stream using a 4K buffer
  @param inputStream the stream to copy
  @param outputStream the stream to write to
  @throws IOException if there is an exception reading or writing