Example usage for io.netty.buffer ByteBuf setLong

List of usage examples for io.netty.buffer ByteBuf setLong

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf setLong.

Prototype

public abstract ByteBuf setLong(int index, long value);

Source Link

Document

Sets the specified 64-bit long integer at the specified absolute index in this buffer.

Usage

From source file:com.talent.mysql.packet.request.AuthPacket.java

License:Open Source License

@Override
public void encodeBody(ByteBuf byteBuf) {
    int index = byteBuf.readerIndex();
    String xx = Long.toBinaryString(clientFlags);
    byteBuf.setLong(index, clientFlags);
    index += 4;//w ww  .  j a  v  a  2 s. c  o  m

    byteBuf.setLong(index, maxPacketSize);
    index += 4;

    byteBuf.setByte(index, charsetIndex);
    index++;

    byteBuf.setBytes(index, extra);
    index += extra.length;

    byteBuf.setBytes(index, user);
    index += user.length;

    byteBuf.setByte(index, 0);
    index++;

    byteBuf.setByte(index, passwordLen);
    index++;

    byteBuf.setBytes(index, password);
    index += password.length;

    byteBuf.setBytes(index, database);
    index += database.length;

    byteBuf.setByte(index, 0);
    index++;
}