public void parse(final Iterator<Header> headerIterator, final BiConsumer<String, String> consumer) {
        while (headerIterator.hasNext()) {
            final Header header = headerIterator.next();
            final CharArrayBuffer buffer;
            final Tokenizer.Cursor cursor;
            if (header instanceof FormattedHeader) {
                buffer = ((FormattedHeader) header).getBuffer();
                cursor = new Tokenizer.Cursor(((FormattedHeader) header).getValuePos(), buffer.length());
            } else {
                final String s = header.getValue();
                if (s == null) {
                    continue;
                }
                buffer = new CharArrayBuffer(s.length());
                buffer.append(s);
                cursor = new Tokenizer.Cursor(0, buffer.length());
            }

            // Parse the header
            while (!cursor.atEnd()) {
                final String name = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS);
                String value = null;
                if (!cursor.atEnd()) {
                    final int valueDelim = buffer.charAt(cursor.getPos());
                    cursor.updatePos(cursor.getPos() + 1);
                    if (valueDelim == EQUAL_CHAR) {
                        value = tokenParser.parseValue(buffer, cursor, VALUE_DELIMS);
                        if (!cursor.atEnd()) {
                            cursor.updatePos(cursor.getPos() + 1);
                        }
                    }
                }
                consumer.accept(name, value);
            }
        }
    }
Constructs a new instance of this parser.
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheControlHeaderParser.java