yexindonglai@163.com
2022-03-01 10:05
Netty
1104°
0
前言什么是Buffer为什么需要BufferByteBufferByteBuffer内部结构代码示例1、初始化:ByteBufferbuffer=ByteBuffer.allocate(10)2、写入:buffer.put(byte)3、翻转:buffer.flip()4、读取:buffer.get(bytes)5、清除缓冲区:buffer.clear()拷贝duplicate()flip()和rewind()的区别ByteBufByteBuf内存池验证内存池读写示例1、实例化:ByteBufbuffer=PooledByteBufAllocator.DEFAULT.buffer(10,10)