docs: @Override
      public PNMHeader parse() throws IOException {
          int width = 0;
          int height = 0;
          float maxSample = tupleType == TupleType.BLACKANDWHITE_WHITE_IS_ZERO ? 1 : 0; // PBM has no maxSample line
  
          List<String> comments = new ArrayList<String>();
  
          while (width == 0 || height == 0 || maxSample == 0) {
              String line = input.readLine();
  
              if (line == null) {
                  throw new IIOException("Unexpeced end of stream");
              }
  
              int commentStart = line.indexOf('#');
              if (commentStart >= 0) {
                  String comment = line.substring(commentStart + 1).trim();
                  if (!comment.isEmpty()) {
                      comments.add(comment);
                  }
  
                  line = line.substring(0, commentStart);
              }
  
              line = line.trim();
  
              if (!line.isEmpty()) {
                  // We have tokens...
                  String[] tokens = line.split("\\s");
                  for (String token : tokens) {
                      if (width == 0) {
                          width = Integer.parseInt(token);
                      }
                      else if (height == 0) {
                          height = Integer.parseInt(token);
                      }
                      else if (maxSample == 0) {
                          maxSample = Float.parseFloat(token);
                      }
                      else {
                          throw new IIOException("Unknown PNM token: " + token);
                      }
                  }
              }
          }
  
          return new PNMHeader(fileType, tupleType, width, height, tupleType.getSamplesPerPixel(), byteOrder(maxSample), comments);
      }