feat(新增): 🚀 ByteBufDemo学习
This commit is contained in:
parent
d7212c4d0a
commit
ce650bd4ea
|
@ -0,0 +1,18 @@
|
|||
package cn.bunny.service.netty.demo6;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
|
||||
public class ByteBufDemo {
|
||||
public static void main(String[] args) {
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue