@Override
            public boolean visitSegment(final int marker, final byte[] markerBytes, final int markerLength, final byte[] markerLengthBytes,
                    final byte[] segmentData) throws ImagingException, IOException {
                if (marker == JpegConstants.EOI_MARKER) {
                    return false;
                }

                // Debug.debug("visitSegment marker", marker);
                // // Debug.debug("visitSegment keepMarker(marker, markers)",
                // keepMarker(marker, markers));
                // Debug.debug("visitSegment keepMarker(marker, markers)",
                // keepMarker(marker, markers));

                if (!keepMarker(marker, markers)) {
                    return true;
                }

                switch (marker) {
                case JpegConstants.JPEG_APP13_MARKER:
                    // Debug.debug("app 13 segment data", segmentData.length);
                    result.add(new App13Segment(marker, segmentData));
                    break;
                case JpegConstants.JPEG_APP14_MARKER:
                    result.add(new App14Segment(marker, segmentData));
                    break;
                case JpegConstants.JPEG_APP2_MARKER:
                    result.add(new App2Segment(marker, segmentData));
                    break;
                case JpegConstants.JFIF_MARKER:
                    result.add(new JfifSegment(marker, segmentData));
                    break;
                default:
                    if (Arrays.binarySearch(sofnSegments, marker) >= 0) {
                        result.add(new SofnSegment(marker, segmentData));
                    } else if (marker == JpegConstants.DQT_MARKER) {
                        result.add(new DqtSegment(marker, segmentData));
                    } else if (marker >= JpegConstants.JPEG_APP1_MARKER && marker <= JpegConstants.JPEG_APP15_MARKER) {
                        result.add(new UnknownSegment(marker, segmentData));
                    } else if (marker == JpegConstants.COM_MARKER) {
                        result.add(new ComSegment(marker, segmentData));
                    }
                    break;
                }

                return !returnAfterFirst;
            }
Extracts embedded XML metadata as XML string.
<p>

@param byteSource File containing image data.
@param params     Map of optional parameters, defined in ImagingConstants.
@return Xmp Xml as String, if present. Otherwise, returns null.
src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java