code: public static List<JPEGSegment> readSegments(final ImageInputStream stream, final int marker, final String identifier) throws IOException {
          return readSegments(stream, Collections.singletonMap(marker, identifier != null ? Collections.singletonList(identifier) : ALL_IDS));
      }
docs: Reads the requested JPEG segments from the stream.
  The stream position must be directly before the SOI marker, and only segments for the current image is read.
  
  @param stream the stream to read from.
  @param marker the segment marker to read
  @param identifier the identifier to read, or {@code null} to match any segment
  @return a list of segments with the given app marker and optional identifier. If no segments are found, an
  empty list is returned.
  @throws IIOException if a JPEG format exception occurs during reading
  @throws IOException if an I/O exception occurs during reading