docs: @Override
      public void writeExternal(ObjectOutput output) throws IOException {
          output.writeInt(SERIALIZATION_V2);
          output.writeInt(this.storage.size());
          output.writeInt(this.numberOfHeaders);
          int count = 0;
          HeaderElement elem = this.hdrSequence;
          while (null != elem) {
              if (!elem.wasRemoved()) {
                  count++;
                  writeByteArray(output, elem.getKey().getByteArray());
                  writeByteArray(output, elem.asBytes());
              }
              elem = elem.nextSequence;
          }
          // double check the counter value
          if (count != this.numberOfHeaders) {
              throw new IOException("Expected " + this.numberOfHeaders
                                    + " headers but wrote " + count);
          }
      }