Java Code Examples for org.jboss.netty.buffer.ChannelBuffer.setInt()

The following are Jave code examples for showing how to use setInt() of the org.jboss.netty.buffer.ChannelBuffer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Elasticsearch   File: NettyHeader.java   Source Code and License Vote up 5 votes
public static void writeHeader(ChannelBuffer buffer, long requestId, byte status, Version version) {
    int index = buffer.readerIndex();
    buffer.setByte(index, 'E');
    index += 1;
    buffer.setByte(index, 'S');
    index += 1;
    // write the size, the size indicates the remaining message size, not including the size int
    buffer.setInt(index, buffer.readableBytes() - 6);
    index += 4;
    buffer.setLong(index, requestId);
    index += 8;
    buffer.setByte(index, status);
    index += 1;
    buffer.setInt(index, version.id);
}