@Override
    public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {

        if (!ExternalParser.check("gdalinfo")) {
            return;
        }

        // first set up and run GDAL
        // process the command
        TemporaryResources tmp = new TemporaryResources();
        TikaInputStream tis = TikaInputStream.get(stream, tmp, metadata);

        String[] runCommand = processCommand(tis).split("\\s+", -1);

        long localTimeoutMillis = TikaTaskTimeout.getTimeoutMillis(context, timeoutMs);
        FileProcessResult result = ProcessUtils.execute(new ProcessBuilder(runCommand),
                localTimeoutMillis, maxStdOut, maxStdErr);

        metadata.set(ExternalProcess.IS_TIMEOUT, result.isTimeout());
        metadata.set(ExternalProcess.EXIT_VALUE, result.getExitValue());
        metadata.set(ExternalProcess.STD_OUT_LENGTH, result.getStdoutLength());
        metadata.set(ExternalProcess.STD_OUT_IS_TRUNCATED, result.isStdoutTruncated());
        metadata.set(ExternalProcess.STD_ERR_LENGTH, result.getStderrLength());
        metadata.set(ExternalProcess.STD_ERR_IS_TRUNCATED, result.isStderrTruncated());

        metadata.set(ExternalProcess.STD_OUT, result.getStdout());
        metadata.set(ExternalProcess.STD_ERR, result.getStderr());

        String output = result.getStdout();

        // now extract the actual metadata params
        // from the GDAL output in the content stream
        // to do this, we need to literally process the output
        // from the invoked command b/c we can't read metadata and
        // output text from the handler in ExternalParser
        // at the same time, so for now, we can't use the
        // ExternalParser to do this and I've had to bring some of
        // that functionality directly into this class
        // TODO: investigate a way to do both using ExternalParser

        extractMetFromOutput(output, metadata);
        applyPatternsToOutput(output, metadata, getPatterns());

        // make the content handler and provide output there
        // now that we have metadata
        processOutput(handler, metadata, output);
    }
Wraps execution of the <a href="http//gdal.org/">Geospatial Data Abstraction
Library (GDAL)</a> <code>gdalinfo</code> tool used to extract geospatial
information out of hundreds of geo file formats.
<p/>
The parser requires the installation of GDAL and for <code>gdalinfo</code> to
be located on the path.
<p/>
Basic information (Size, Coordinate System, Bounding Box, Driver, and
resource info) are extracted as metadata, and the remaining metadata patterns
are extracted and added.
<p/>
The output of the command is available from the provided
{@link ContentHandler} in the
{@link #parse(InputStream, ContentHandler, Metadata, ParseContext)} method.
tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/gdal/GDALParser.java