Example usage for io.netty.buffer ByteBufAllocator compositeBuffer

List of usage examples for io.netty.buffer ByteBufAllocator compositeBuffer

Introduction

In this page you can find the example usage for io.netty.buffer ByteBufAllocator compositeBuffer.

Prototype

CompositeByteBuf compositeBuffer(int maxNumComponents);

Source Link

Document

Allocate a CompositeByteBuf with the given maximum number of components that can be stored in it.

Usage

From source file:com.tesora.dve.db.mysql.portal.protocol.Packet.java

License:Open Source License

public Packet(ByteBufAllocator alloc, int expectedSequence, Modifier mod, String context) {
    this.expectedSequence = expectedSequence;
    this.modifier = mod;
    this.context = context;
    if (modifier == Modifier.HEAPCOPY_ON_READ) {
        header = Unpooled.buffer(4, 4).order(ByteOrder.LITTLE_ENDIAN);
        payload = Unpooled.compositeBuffer(50);
    } else {/*w w  w . ja  va  2s .  co m*/
        header = alloc.ioBuffer(4, 4).order(ByteOrder.LITTLE_ENDIAN);
        payload = alloc.compositeBuffer(50);
    }
}