@Override
    public boolean processFileResource(FileResource fileResource) {
        String relPath = fileResource
                .getMetadata()
                .get(FSProperties.FS_REL_PATH);
        try (InputStream is = fileResource.openInputStream()) {
            try (TikaInputStream tis = TikaInputStream.get(is)) {
                Path path = tis.getPath();
                Map<Cols, String> data = new HashMap<>();
                int tikaMimeId = writer.getMimeId(detectTika(tis));
                String fileName = "";
                String extension = "";
                long length = -1;
                try {
                    fileName = FilenameUtils.getName(relPath);
                } catch (IllegalArgumentException e) {
                    LOG.warn("bad file name: " + relPath, e);
                }

                try {
                    extension = FilenameUtils.getExtension(relPath);
                } catch (IllegalArgumentException e) {
                    LOG.warn("bad extension: " + relPath, e);
                }

                try {
                    length = Files.size(path);
                } catch (IOException e) {
                    LOG.warn("problem getting size: " + relPath, e);
                }

                data.put(Cols.FILE_PATH, relPath);
                data.put(Cols.FILE_NAME, fileName);
                data.put(Cols.FILE_EXTENSION, extension);
                data.put(Cols.LENGTH, Long.toString(length));
                data.put(Cols.TIKA_MIME_ID, Integer.toString(tikaMimeId));
                data.put(Cols.SHA256, DigestUtils.sha256Hex(tis));
                if (HAS_FILE) {
                    int fileMimeId = writer.getMimeId(detectFile(tis));
                    data.put(Cols.FILE_MIME_ID, Integer.toString(fileMimeId));
                }
                writer.writeRow(FILE_PROFILES, data);
            }
        } catch (IOException e) {
            //log at least!
            return false;
        }
        return true;
    }
This class profiles actual files as opposed to extracts e.g. {@link ExtractProfiler}.
This does _not_ parse files, but does run file type identification and digests the
raw bytes.
<p>
If the 'file' command is available on the command line, this will also run the
FileCommandDetector.
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/FileProfiler.java