Example usage for io.netty.buffer ByteBufAllocator ioBuffer

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

Introduction

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

Prototype

ByteBuf ioBuffer(int initialCapacity, int maxCapacity);

Source Link

Document

Allocate a ByteBuf , preferably a direct buffer which is suitable for I/O.

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 {//from   w  w  w. j ava2  s .  c  o m
        header = alloc.ioBuffer(4, 4).order(ByteOrder.LITTLE_ENDIAN);
        payload = alloc.compositeBuffer(50);
    }
}