public void expandAtMost(final int atMostBytes) {
        if (this.buffer == null) {
            this.buffer = Utils.allocate(atMostBytes);
        } else {
            this.buffer = Utils.expandByteBufferAtMost(this.buffer, atMostBytes);
        }
    }
A byte buffer collector that will expand automatically.

@author dennis
jraft-core/src/main/java/com/alipay/sofa/jraft/util/ByteBufferCollector.java