use of com.generallycloud.baseio.buffer.ByteBuf in project baseio by generallycloud.
the class TestUnpooledByteBufAllocator method test.
static void test() {
UnpooledByteBufAllocator allocator = UnpooledByteBufAllocator.getDirect();
byte[] data = "你好啊,world".getBytes();
ByteBuf buf = allocator.allocate(data.length);
buf.put(data);
buf.flip();
ReleaseUtil.release(buf);
for (; ; ) {
ByteBuf buf2 = buf.duplicate();
byte[] bb = buf2.getBytes();
String s = new String(bb);
System.out.println(s);
}
}
Aggregations