package cn.bunny.service.netty.demo3;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;

import static cn.bunny.service.NettyLogUtil.log;

public class ByteBufDemo {
    public static void main(String[] args) {
        // 堆内存
        // ByteBuf buf = ByteBufAllocator.DEFAULT.heapBuffer();
        // 非池化的
        ByteBuf buf = ByteBufAllocator.DEFAULT.buffer();
        System.out.println(buf);

        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < 300; i++) {
            stringBuilder.append("a");
        }

        buf.writeBytes(stringBuilder.toString().getBytes());
        System.out.println(buf);
        log(buf);
    }
}
