package com.ruoyi.netty.communication;
|
|
import io.netty.buffer.ByteBuf;
|
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelHandlerContext;
|
import lombok.extern.slf4j.Slf4j;
|
|
/**
|
* @author 86175
|
*/
|
@Slf4j
|
public abstract class ChannelHandlerContextUtils {
|
|
|
public static ChannelFuture writeAndFlush(ChannelHandlerContext ctx, byte[] msg) {
|
ByteBuf byteBuf = ctx.alloc().buffer();
|
byteBuf.writeBytes(msg);
|
return ctx.writeAndFlush(byteBuf);
|
}
|
|
|
}
|