shrinkBufferCapacity(to:)

The ByteBuffer will successfully be shrunk if the requested capacity is less than the current capacity, and the requested capacity is greater than or equal to the number of readable bytes in the buffer. If either condition is not true, the buffer will not be shrunk.

ByteBuffer-core.swift:942
@discardableResult mutating func shrinkBufferCapacity(to desiredCapacity: Int) -> Bool

Parameters

desiredCapacity

The desired capacity for the buffers capacity to be shrunken to

Returns

Bool indicating whether the buffer capacity has been shrunk to the desiredCapacity.