@Test public void testJPEGGeo() throws Exception { Metadata metadata = new Metadata(); metadata.set(Metadata.CONTENT_TYPE, "image/jpeg"); try (InputStream stream = getClass().getResourceAsStream("/test-documents/testJPEG_GEO.jpg")) { parser.parse(stream, new DefaultHandler(), metadata, new ParseContext()); } assertEquals("12.54321", metadata.get(Metadata.LATITUDE)); assertEquals("-54.1234", metadata.get(Metadata.LONGITUDE)); assertEquals("3888", metadata.get(Metadata.IMAGE_WIDTH)); assertEquals("2592", metadata.get(Metadata.IMAGE_LENGTH)); assertEquals("8", metadata.get(Metadata.BITS_PER_SAMPLE)); assertEquals(null, metadata.get(Metadata.SAMPLES_PER_PIXEL)); assertEquals("6.25E-4", metadata.get(Metadata.EXPOSURE_TIME)); assertEquals("5.6", metadata.get(Metadata.F_NUMBER)); assertEquals("false", metadata.get(Metadata.FLASH_FIRED)); assertEquals("194.0", metadata.get(Metadata.FOCAL_LENGTH)); assertEquals("400", metadata.get(Metadata.ISO_SPEED_RATINGS)); assertEquals("Canon", metadata.get(Metadata.EQUIPMENT_MAKE)); assertEquals("Canon EOS 40D", metadata.get(Metadata.EQUIPMENT_MODEL)); assertEquals("Adobe Photoshop CS3 Macintosh", metadata.get(Metadata.SOFTWARE)); assertEquals(null, metadata.get(Metadata.ORIENTATION)); assertEquals("240.0", metadata.get(Metadata.RESOLUTION_HORIZONTAL)); assertEquals("240.0", metadata.get(Metadata.RESOLUTION_VERTICAL)); assertEquals("Inch", metadata.get(Metadata.RESOLUTION_UNIT)); assertEquals("Date/Time Original for when the photo was taken, unspecified time zone", "2009-08-11T09:09:45", metadata.get(TikaCoreProperties.CREATED)); assertEquals("This image has different Date/Time than Date/Time Original, so it is probably modification date", "2009-10-02T23:02:49", metadata.get(Metadata.LAST_MODIFIED)); assertEquals("Date/Time Original should be stored in EXIF field too", "2009-08-11T09:09:45", metadata.get(TIFF.ORIGINAL_DATE)); assertEquals("canon-55-250", metadata.getValues(TikaCoreProperties.SUBJECT)[0]); }
public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = new TemporaryResources(); try { TikaInputStream tis = TikaInputStream.get(stream, tmp); new ImageMetadataExtractor(metadata).parseJpeg(tis.getFile()); new JempboxExtractor(metadata).parse(tis); } finally { tmp.dispose(); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }
JpegParser extends AbstractParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = new TemporaryResources(); try { TikaInputStream tis = TikaInputStream.get(stream, tmp); new ImageMetadataExtractor(metadata).parseJpeg(tis.getFile()); new JempboxExtractor(metadata).parse(tis); } finally { tmp.dispose(); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); } }
JpegParser extends AbstractParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = new TemporaryResources(); try { TikaInputStream tis = TikaInputStream.get(stream, tmp); new ImageMetadataExtractor(metadata).parseJpeg(tis.getFile()); new JempboxExtractor(metadata).parse(tis); } finally { tmp.dispose(); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }  }
JpegParser extends AbstractParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = new TemporaryResources(); try { TikaInputStream tis = TikaInputStream.get(stream, tmp); new ImageMetadataExtractor(metadata).parseJpeg(tis.getFile()); new JempboxExtractor(metadata).parse(tis); } finally { tmp.dispose(); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }  Set<MediaType> getSupportedTypes(ParseContext context); void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context); }
JpegParser extends AbstractParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = new TemporaryResources(); try { TikaInputStream tis = TikaInputStream.get(stream, tmp); new ImageMetadataExtractor(metadata).parseJpeg(tis.getFile()); new JempboxExtractor(metadata).parse(tis); } finally { tmp.dispose(); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }  Set<MediaType> getSupportedTypes(ParseContext context); void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context);  }