public void parse(InputStream file) throws IOException, TikaException {
        UnsynchronizedByteArrayOutputStream xmpraw = UnsynchronizedByteArrayOutputStream.builder().get();
        if (!scanner.parse(file, xmpraw)) {
            return;
        }

        XMPMetadata xmp = null;
        try (InputStream decoded = xmpraw.toInputStream()) {
            Document dom = XMLReaderUtils.buildDOM(decoded, EMPTY_PARSE_CONTEXT);
            if (dom != null) {
                xmp = new XMPMetadata(dom);
            }
        } catch (IOException | SAXException e) {
            //
        }
        extractDublinCore(xmp, metadata);
        extractXMPMM(xmp, metadata);
    }
@Test
    public void testParseJpegPhotoshop() throws IOException, TikaException {
        Metadata metadata = new Metadata();
        try (InputStream stream = getResourceAsStream(
                "/test-documents/testJPEG_commented_pspcs2mac.jpg")) {
            JempboxExtractor extractor = new JempboxExtractor(metadata);
            extractor.parse(stream);

            // DublinCore fields
            assertEquals("Tosteberga \u00C4ngar", metadata.get(TikaCoreProperties.TITLE));
            assertEquals("Bird site in north eastern Sk\u00E5ne, Sweden.\n(new line)",
                    metadata.get(TikaCoreProperties.DESCRIPTION));
            assertEquals("Some Tourist", metadata.get(TikaCoreProperties.CREATOR));
            Collection<String> keywords =
                    Arrays.asList(metadata.getValues(TikaCoreProperties.SUBJECT));
            assertTrue(keywords.contains("bird watching"));
            assertTrue(keywords.contains("coast"));
        }
    }