1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| @Test public void test2() { ByteBuf b = getBuf(); System.out.println("原始数据:" + b); //原始数据:UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 4, widx: 12, cap: 1024)
b = getBuf(); System.out.println("copy:" + b.copy()); //copy:UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 8, cap: 8)
b = getBuf(); System.out.println("duplicate:" + b.duplicate()); //duplicate:UnpooledDuplicatedByteBuf(ridx: 4, widx: 12, cap: 1024, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 4, widx: 12, cap: 1024))
b = getBuf(); System.out.println("slice;" + b.slice()); //slice;UnpooledSlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 4, widx: 12, cap: 1024))
}
|