int size(ObjectSerializationCache serializationCache) {
        this.size = data.size(serializationCache, headerVersion);
        return size;
    }
Calculates the size of {@link RequestHeader} in bytes.

This method to calculate size should be only when it is immediately followed by
{@link #write(ByteBuffer, ObjectSerializationCache)} method call. In such cases, ObjectSerializationCache
helps to avoid the serialization twice. In all other cases, {@link #size()} should be preferred instead.

Calls to this method leads to calculation of size every time it is invoked. {@link #size()} should be preferred
instead.

Visible for testing.
clients/src/main/java/org/apache/kafka/common/requests/RequestHeader.java