code: public static File copy(InputStream stream) throws IOException
    {
      File file = createTempFile();
      copy(stream, new FileOutputStream(file));
      return file;
    }
docs: Binary copy to temporary file. Be aware that temporary file is removed at JVM exit.
  
  @param stream source stream.
  @return temporarily created file.
  @throws IOException if copy operation fails.