docs: public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
      {
          final int preambleLength = XMP_JPEG_PREAMBLE.length();
          final int extensionPreambleLength = XMP_EXTENSION_JPEG_PREAMBLE.length();
          String extendedXMPGUID = null;
          byte[] extendedXMPBuffer = null;
  
          for (byte[] segmentBytes : segments) {
              // XMP in a JPEG file has an identifying preamble which is not valid XML
              if (segmentBytes.length >= preambleLength) {
                  // NOTE we expect the full preamble here, but some images (such as that reported on GitHub #102)
                  // start with "XMP\0://ns.adobe.com/xap/1.0/" which appears to be an error but is easily recovered
                  // from. In such cases, the actual XMP data begins at the same offset.
                  if (XMP_JPEG_PREAMBLE.equalsIgnoreCase(new String(segmentBytes, 0, preambleLength)) ||
                      "XMP".equalsIgnoreCase(new String(segmentBytes, 0, 3))) {
  
                      byte[] xmlBytes = new byte[segmentBytes.length - preambleLength];
                      System.arraycopy(segmentBytes, preambleLength, xmlBytes, 0, xmlBytes.length);
                      extract(xmlBytes, metadata);
                      // Check in the Standard XMP if there should be a Extended XMP part in other chunks.
                      extendedXMPGUID = getExtendedXMPGUID(metadata);
                      continue;
                  }
              }
  
              // If we know that there's Extended XMP chunks, look for them.
              if (extendedXMPGUID != null &&
                  segmentBytes.length >= extensionPreambleLength &&
                  XMP_EXTENSION_JPEG_PREAMBLE.equalsIgnoreCase(new String(segmentBytes, 0, extensionPreambleLength))) {
  
                  extendedXMPBuffer = processExtendedXMPChunk(metadata, segmentBytes, extendedXMPGUID, extendedXMPBuffer);
              }
          }
  
          // Now that the Extended XMP chunks have been concatenated, let's parse and merge with the Standard XMP.
          if (extendedXMPBuffer != null) {
              extract(extendedXMPBuffer, metadata);
          }
      }