Expands the buffer {@link #capacity()} to make sure the number of
{@linkplain #writableBytes() writable bytes} is equal to or greater than the
specified value. Unlike {@link #ensureWritable(int)}, this method returns a status code.
@param minWritableBytes
the expected minimum number of writable bytes
@param force
When {@link #writerIndex()} + {@code minWritableBytes} > {@link #maxCapacity()}:
<ul>
<li>{@code true} - the capacity of the buffer is expanded to {@link #maxCapacity()}</li>
<li>{@code false} - the capacity of the buffer is unchanged</li>
</ul>
@return {@code 0} if the buffer has enough writable bytes, and its capacity is unchanged.
{@code 1} if the buffer does not have enough bytes, and its capacity is unchanged.
{@code 2} if the buffer has enough writable bytes, and its capacity has been increased.
{@code 3} if the buffer does not have enough bytes, but its capacity has been
increased to its maximum.
Expands the buffer {@link #capacity()} to make sure the number of {@linkplain #writableBytes() writable bytes} is equal to or greater than the specified value. Unlike {@link #ensureWritable(int)}, this method returns a status code.
@param minWritableBytes the expected minimum number of writable bytes @param force When {@link #writerIndex()} + {@code minWritableBytes} > {@link #maxCapacity()}: <ul> <li>{@code true} - the capacity of the buffer is expanded to {@link #maxCapacity()}</li> <li>{@code false} - the capacity of the buffer is unchanged</li> </ul> @return {@code 0} if the buffer has enough writable bytes, and its capacity is unchanged. {@code 1} if the buffer does not have enough bytes, and its capacity is unchanged. {@code 2} if the buffer has enough writable bytes, and its capacity has been increased. {@code 3} if the buffer does not have enough bytes, but its capacity has been increased to its maximum.