package tju.SpringBootPostServer.controller;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.CharsetUtil;
public class TestMe {
public static void main(String[] args) throws UnsupportedEncodingException {
ByteBuf byteBuf = Unpooled.copiedBuffer("current time is: "+new Date(),CharsetUtil.UTF_8);
byte[] bytes = new byte[byteBuf.readableBytes()];
byteBuf.readBytes(bytes);
String body = new String(bytes,"UTF-8");
System.out.println(body);
}
}
还没有评论,来说两句吧...