private int doStrings(File input, StringsConfig config, XHTMLContentHandler xhtml)
            throws IOException, TikaException, SAXException {

        String stringsProg = getStringsPath() + getStringsProg();

        // Builds the command array
        ArrayList<String> cmdList = new ArrayList<>(4);
        cmdList.add(stringsProg);
        cmdList.add("-n");
        cmdList.add("" + config.getMinLength());
        // Currently, encoding option is not supported by Windows (and other) versions
        if (hasEncodingOption) {
            cmdList.add("-e");
            cmdList.add("" + config.getEncoding().get());
        }
        cmdList.add(input.getPath());

        String[] cmd = cmdList.toArray(new String[0]);

        ProcessBuilder pb = new ProcessBuilder(cmd);
        final Process process = pb.start();

        InputStream out = process.getInputStream();
        AtomicInteger totalBytes = new AtomicInteger();
        // Reads content printed out by "strings" command
        Thread gobbler = logStream(out, xhtml, totalBytes);
        gobbler.start();
        try {
            boolean completed = process.waitFor(config.getTimeoutSeconds(), TimeUnit.SECONDS);
            if (!completed) {
                throw new TimeoutException("timed out");
            }
            gobbler.join(10000);
        } catch (InterruptedException | TimeoutException e) {
            throw new TikaException("strings process failed", e);
        } finally {
            process.destroyForcibly();
        }

        return totalBytes.get();
    }
Runs the "strings" command on the given file.

@param input  {@see File} object that represents the file to parse.
@param config {@see StringsConfig} object including the strings
              configuration.
@param xhtml  {@see XHTMLContentHandler} object.
@return the total number of bytes read using the strings command.
@throws IOException   if any I/O error occurs.
@throws TikaException if the parsing process has been interrupted.
@throws SAXException
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/strings/StringsParser.java