code: public static File writeToTempFile(InputStream inputStream, String prefix, String suffix) throws IOException {
  
          File file = File.createTempFile(prefix, "." + suffix);
          writeToFile(inputStream, file);
          return file;
      }
docs: Writes from an InputStream to a temporary file