code: private void extract(@NotNull final EpsDirectory directory, @NotNull Metadata metadata, @NotNull SequentialReader reader) throws IOException
      {
          StringBuilder line = new StringBuilder();
  
          while (true) {
              line.setLength(0);
  
              // Read the next line, excluding any trailing newline character
              // Note that for Windows-style line endings ("\r\n") the outer loop will be run a second time with an empty
              // string, which is fine.
              while (true) {
                  char c = (char)reader.getByte();
                  if (c == '\r' || c == '\n')
                      break;
                  line.append(c);
              }
  
              // Stop when we hit a line that is not a comment
              if (line.length() != 0 && line.charAt(0) != '%')
                  break;
  
              String name;
  
              // ':' signifies there is an associated keyword (should be put in directory)
              // otherwise, the name could be a marker
              int colonIndex = line.indexOf(":");
              if (colonIndex != -1) {
                  name = line.substring(0, colonIndex).trim();
                  String value = line.substring(colonIndex + 1).trim();
                  addToDirectory(directory, name, value);
              } else {
                  name = line.toString().trim();
              }
  
              // Some comments will both have a value and signify a new block to follow
              if (name.equals("%BeginPhotoshop")) {
                  extractPhotoshopData(metadata, reader);
              } else if (name.equals("%%BeginICCProfile")) {
                  extractIccData(metadata, reader);
              } else if (name.equals("%begin_xml_packet")) {
                  extractXmpData(metadata, reader);
              }
          }
      }
docs: Main method that parses all comments and then distributes data extraction among other methods that parse the
  rest of file and store encountered data in metadata (if there exists an entry in EpsDirectory
  for the found data).  Reads until a begin data/binary comment is found or _reader's estimated
  available data has run out (or AI09 End Private Data).  Will extract data from normal EPS comments, Photoshop, ICC, and XMP.
  
  @param metadata Metadata to add directory to and extracted data