docs: public static List<JPEGSegment> readSegments(final ImageInputStream stream, final Map<Integer, List<String>> segmentIdentifiers) throws IOException {
          readSOI(notNull(stream, "stream"));
  
          List<JPEGSegment> segments = Collections.emptyList();
  
          JPEGSegment segment;
          try {
              do {
                  segment = readSegment(stream, segmentIdentifiers);
  //                System.err.println("segment: " + segment);
  
                  if (isRequested(segment, segmentIdentifiers)) {
                      if (segments == Collections.EMPTY_LIST) {
                          segments = new ArrayList<>();
                      }
  
                      segments.add(segment);
                  }
              }
              while (!isImageDone(segment));
          }
          catch (EOFException ignore) {
              // Just end here, in case of malformed stream
          }
  
          // TODO: Should probably skip until EOI, so that multiple invocations succeeds for multiple image streams.
  
          return segments;
      }