for (byte[] app1Segment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APP1)) {
if (app1Segment.length > 3 && "EXIF".equalsIgnoreCase(new String(app1Segment, 0, 4)))
new ExifReader().extract(new ByteArrayReader(app1Segment), metadata);
if (app1Segment.length > 27 && "http://ns.adobe.com/xap/1.0/".equalsIgnoreCase(new String(app1Segment, 0, 28)))
new XmpReader().extract(new ByteArrayReader(app1Segment), metadata);
}
// Loop through all APP2 segments, looking for something we can process.
for (byte[] app2Segment : segmentReader.getSegments(JpegSegmentReader.SEGMENT_APP2)) {
if (app2Segment.length > 10 && new String(app2Segment, 0, 11).equalsIgnoreCase("ICC_PROFILE")) {