Example usage for io.netty.buffer CompositeByteBuf writeByte

List of usage examples for io.netty.buffer CompositeByteBuf writeByte

Introduction

In this page you can find the example usage for io.netty.buffer CompositeByteBuf writeByte.

Prototype

@Override
    public CompositeByteBuf writeByte(int value) 

Source Link

Usage

From source file:io.datty.msgpack.test.CompositeByteBufTest.java

License:Apache License

@Test
public void testCompositeWrite() {

    ByteBuf first = Unpooled.buffer();//from  ww w.jav  a 2s  .  c  o  m
    first.writeByte('a');
    CompositeByteBuf result = first.alloc().compositeBuffer();
    result.addComponent(true, first);
    result.writeByte('b');

    byte[] actual = ByteBufUtil.getBytes(result);

    Assert.assertEquals(2, actual.length);
    Assert.assertEquals('a', actual[0]);
    Assert.assertEquals('b', actual[1]);

}