@Override
        public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException {
            String name = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY);
            if (name != null && wanted.containsKey(name)) {
                try (FileOutputStream out = new FileOutputStream(wanted.get(name))) {
                    IOUtils.copy(stream, out);
                }
            } else {
                if (downstreamParser != null) {
                    downstreamParser.parse(stream, handler, metadata, context);
                }
            }
        }
A recursive parser that saves certain images into the temporary
directory, and delegates everything else to another downstream
parser.
tika-app/src/main/java/org/apache/tika/gui/TikaGUI.java