code: private void copy(OutputStream out, File in) throws IOException {
          FileInputStream inStream = null;
          try {
              inStream = new FileInputStream(in);
  
              byte[] buffer = new byte[4096];
              int len;
              while ((len = inStream.read(buffer)) != -1) {
                  out.write(buffer, 0, len);
              }
          } finally {
              if (inStream != null) {
                  inStream.close();
              }
          }
      }
docs: Copies the file to the output stream
  
  @param out The stream to write to
  @param in The file to write
  @throws IOException If something goes wrong