code: private File extractToTemp(InputStream _fileToExtract, String _tmpName, String _fileSuffix) throws IOException {
          if (_fileToExtract == null) {
              throw new IOException("Null stream");
          }
          File tempFile = File.createTempFile(_tmpName, _fileSuffix);
          tempFile.deleteOnExit();
  
          if (!tempFile.exists()) {
              throw new FileNotFoundException("File " + tempFile.getAbsolutePath() + " could not be created");
          }
  
          byte[] buffer = new byte[1024];
          int readBytes;
  
          OutputStream os = new FileOutputStream(tempFile);
          try {
              while ((readBytes = _fileToExtract.read(buffer)) != -1) {
                  os.write(buffer, 0, readBytes);
              }
          } finally {
              os.close();
              _fileToExtract.close();
          }
          return tempFile;
      }
docs: Extract the file behind InputStream _fileToExtract to the tmp-folder.
  
  @param _fileToExtract InputStream with file to extract
  @param _tmpName temp file name
  @param _fileSuffix temp file suffix
  
  @return temp file object
  @throws IOException on any error