Netty ByteBuf 相关 API
发布时间
阅读量:
阅读量
package com.example.demo.util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
public class ByteBufTest {
public static void main(String[] args) {
//初始容量9 最大容量100
ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(9, 100);
print("ByteBufAllocator.DEFAULT.buffer(9,100)", buf);
//write方法改变写指针 写完之后写指针小于capacity buf仍可写
buf.writeBytes(new byte[]{1, 2, 3, 4});
print("writeBytes(1,2,3,4)", buf);
// int类型占四字节 写完int后 写指针增加4
buf.writeInt(11);
全部评论 (0)
还没有任何评论哟~
