aeron-driver/src/main/java/io/aeron/driver/media/NetworkUtil.java
public static ByteBuffer allocateDirectAlignedAndPadded(final int capacity, final int alignment)
    {
        final ByteBuffer buffer = BufferUtil.allocateDirectAligned(capacity + alignment, alignment);

        buffer.limit(buffer.limit() - alignment);

        return buffer.slice();
    }
public static ByteBuffer allocateDirectAlignedAndPadded(final int capacity, final int alignment)
    {
        final ByteBuffer buffer = BufferUtil.allocateDirectAligned(capacity + alignment, alignment);

        buffer.limit(buffer.limit() - alignment);

        return buffer.slice();
    }
public static ByteBuffer allocateDirectAlignedAndPadded ( final int capacity , final int alignment ) { final ByteBuffer buffer = BufferUtil . allocateDirectAligned ( capacity + alignment , alignment ) ; buffer . limit ( buffer . limit ( ) - alignment ) ; return buffer . slice ( ) ; }
Allocate a direct {@link ByteBuffer} that is padded at the end with at least alignment bytes.

@param capacity  for the buffer.
@param alignment for the buffer.
@return the direct {@link ByteBuffer}.
Allocate a direct { @link ByteBuffer } that is padded at the end with at least alignment bytes .