segmentReader = new JpegSegmentReader(new ByteArrayInputStream(b));
byte[] exifSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APP1);
byte[] iptcSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APPD);
Metadata metadata = new Metadata();
new ExifReader(exifSegment).extract(metadata);
new IptcReader(iptcSegment).extract(metadata);
@SuppressWarnings("unchecked")
Iterator<Directory> directories = metadata.getDirectoryIterator();
HashMap<String, String> props = new HashMap<String, String>();