private void writeToByteArray(final PBLogEntry pbLogEntry, final byte[] array, final int offset, final int len) {
        final CodedOutputStream output = CodedOutputStream.newInstance(array, offset, len);
        try {
            pbLogEntry.writeTo(output);
            output.checkNoSpaceLeft();
        } catch (final IOException e) {
            throw new LogEntryCorruptedException(
                "Serializing PBLogEntry to a byte array threw an IOException (should never happen).", e);
        }
    }
V2 log entry encoder based on protobuf, see src/main/resources/log.proto

@author boyan(boyan@antfin.com)
jraft-core/src/main/java/com/alipay/sofa/jraft/entity/codec/v2/V2Encoder.java