private File getOutputFile(String name, Metadata metadata, MediaType contentType) {
            String ext = getExtension(contentType);
            if (name.indexOf('.') == -1 && contentType != null) {
                name += ext;
            }

            String relID = metadata.get(TikaCoreProperties.EMBEDDED_RELATIONSHIP_ID);
            if (relID != null && !name.startsWith(relID)) {
                name = relID + "_" + name;
            }
            //defensively do this so that we don't get an exception
            //from FilenameUtils.normalize
            name = name.replaceAll("\u0000", " ");
            String normalizedName = FilenameUtils.normalize(name);

            if (normalizedName == null) {
                normalizedName = FilenameUtils.getName(name);
            }

            if (normalizedName == null) {
                normalizedName = "file" + count++ + ext;
            }
            //strip off initial C:/ or ~/ or /
            int prefixLength = FilenameUtils.getPrefixLength(normalizedName);
            if (prefixLength > -1) {
                normalizedName = normalizedName.substring(prefixLength);
            }
            File outputFile = new File(extractDir, normalizedName);
            //if file already exists, prepend uuid
            if (outputFile.exists()) {
                String fileName = FilenameUtils.getName(normalizedName);
                outputFile = new File(extractDir, UUID
                        .randomUUID()
                        .toString() + "-" + fileName);
            }
            return outputFile;
        }
Outputs the Tika metadata as XMP using the Tika XMP module
tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java