private void writeFinalEmbeddedPaths() {
        //for some file types, the file's "name" is not known before
        //their attachments are parsed. This goes through the id paths
        //and regenerates the path for the "final embedded resource path"
        Map<String, String> idToName = new HashMap<>();
        AtomicInteger unknownCount = new AtomicInteger(0);
        for (Metadata metadata : metadataList) {
            String id = metadata.get(TikaCoreProperties.EMBEDDED_ID);
            if (id == null) {
                continue;
            }
            String name = RecursiveParserWrapper.getResourceName(metadata, unknownCount);
            idToName.put(id, name);
        }
        for (Metadata metadata : metadataList) {
            String idPath = metadata.get(TikaCoreProperties.EMBEDDED_ID_PATH);
            if (idPath == null) {
                continue;
            }
            if (idPath.startsWith("/")) {
                idPath = idPath.substring(1);
            }
            String[] ids = idPath.split("/");
            StringBuilder sb = new StringBuilder();
            for (String id : ids) {
                sb.append("/").append(idToName.get(id));
            }
            metadata.set(TikaCoreProperties.FINAL_EMBEDDED_RESOURCE_PATH, sb.toString());
        }
    }
@param contentHandler content handler used on the main document
@param metadata       metadata from the main document
@throws SAXException
tika-core/src/main/java/org/apache/tika/sax/RecursiveParserWrapperHandler.java