public Path createTempFile(String suffix) throws IOException {
        String actualSuffix = StringUtils.isBlank(suffix) ? ".tmp" : suffix;

        final Path path = tempFileDir == null ? Files.createTempFile("apache-tika-", actualSuffix) :
                Files.createTempFile(tempFileDir, "apache-tika-", actualSuffix);
        addResource(() -> {
            try {
                Files.delete(path);
            } catch (IOException e) {
                // delete when exit if current delete fail
                LOG.warn("delete tmp file fail, will delete it on exit");
                path.toFile().deleteOnExit();
            }
        });
        return path;
    }
Creates a temporary file that will automatically be deleted when
the {@link #close()} method is called, returning its path.
@param suffix -- the suffix of the file if known, starting with "." as in ".pdf"
@return Path to created temporary file that will be deleted after closing
@throws IOException
tika-core/src/main/java/org/apache/tika/io/TemporaryResources.java