private String getExtension(MediaType contentType) {
            try {
                String ext = config
                        .getMimeRepository()
                        .forName(contentType.toString())
                        .getExtension();
                if (ext == null) {
                    return ".bin";
                } else {
                    return ext;
                }
            } catch (MimeTypeException e) {
                e.printStackTrace();
            }
            return ".bin";

        }
Outputs the Tika metadata as XMP using the Tika XMP module
tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java