HttpObjectEncoder.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:netty4.0.27Learn 作者:
private static long contentLength(Object msg) {
    if (msg instanceof HttpContent) {
        return ((HttpContent) msg).content().readableBytes();
    }
    if (msg instanceof ByteBuf) {
        return ((ByteBuf) msg).readableBytes();
    }
    if (msg instanceof FileRegion) {
        return ((FileRegion) msg).count();
    }
    throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号