@Test public void testParseJpegXnviewmp() throws IOException, TikaException { Metadata metadata = new Metadata(); try (InputStream stream = getClass().getResourceAsStream("/test-documents/testJPEG_commented_xnviewmp026.jpg")) { JempboxExtractor extractor = new JempboxExtractor(metadata); extractor.parse(stream); assertEquals("Bird site in north eastern Sk\u00E5ne, Sweden.\n(new line)", metadata.get(TikaCoreProperties.DESCRIPTION)); Collection<String> keywords = Arrays.asList(metadata.getValues(TikaCoreProperties.SUBJECT)); assertTrue(keywords.contains("coast")); assertTrue(keywords.contains("nature reserve")); } }
public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } XMPMetadata xmp = null; try (InputStream decoded = new ByteArrayInputStream(xmpraw.toByteArray()) ) { 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); }
JempboxExtractor { public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } XMPMetadata xmp = null; try (InputStream decoded = new ByteArrayInputStream(xmpraw.toByteArray()) ) { 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); } }
JempboxExtractor { public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } XMPMetadata xmp = null; try (InputStream decoded = new ByteArrayInputStream(xmpraw.toByteArray()) ) { 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); } JempboxExtractor(Metadata metadata); }
JempboxExtractor { public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } XMPMetadata xmp = null; try (InputStream decoded = new ByteArrayInputStream(xmpraw.toByteArray()) ) { 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); } JempboxExtractor(Metadata metadata); void parse(InputStream file); static void extractDublinCore(XMPMetadata xmpMetadata, Metadata metadata); static void extractXMPMM(XMPMetadata xmp, Metadata metadata); static void setMaxXMPMMHistory(int maxEvents); static int getMaxXMPMMHistory(); }
JempboxExtractor { public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } XMPMetadata xmp = null; try (InputStream decoded = new ByteArrayInputStream(xmpraw.toByteArray()) ) { 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); } JempboxExtractor(Metadata metadata); void parse(InputStream file); static void extractDublinCore(XMPMetadata xmpMetadata, Metadata metadata); static void extractXMPMM(XMPMetadata xmp, Metadata metadata); static void setMaxXMPMMHistory(int maxEvents); static int getMaxXMPMMHistory();  }