code: private void add(byte[] name, byte[] value) {
      int headerSize = HeaderField.sizeOf(name, value);
  
      // Clear the table if the header field size is larger than the capacity.
      if (headerSize > capacity) {
        clear();
        return;
      }
  
      // Evict oldest entries until we have enough capacity.
      while (size + headerSize > capacity) {
        remove();
      }
  
      // Copy name and value that modifications of original do not affect the dynamic table.
      name = Arrays.copyOf(name, name.length);
      value = Arrays.copyOf(value, value.length);
  
      int h = hash(name);
      int i = index(h);
      HeaderEntry old = headerFields[i];
      HeaderEntry e = new HeaderEntry(h, name, value, head.before.index - 1, old);
      headerFields[i] = e;
      e.addBefore(head);
      size += headerSize;
    }
docs: Add the header field to the dynamic table.
  Entries are evicted from the dynamic table until the size of the table
  and the new header field is less than the table's capacity.
  If the size of the new entry is larger than the table's capacity,
  the dynamic table will be cleared.