private static String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg) {
        String chStr = ctx.channel().toString();
        int length = msg.readableBytes();
        if (length == 0) {
            StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 4);
            buf.append(chStr).append(' ').append(eventName).append(": 0B");
            return buf.toString();
        } else {
            int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
            StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + 10 + 1 + 2 + rows * 80);

            buf.append(chStr).append(' ').append(eventName).append(": ").append(length).append('B').append(NEWLINE);
            appendPrettyHexDump(buf, msg);

            return buf.toString();
        }
    }
private static String formatByteBuf ( ChannelHandlerContext ctx , String eventName , ByteBuf msg ) { String chStr = ctx . channel ( ) . toString ( ) ; int length = msg . readableBytes ( ) ; if ( length == 0 ) { StringBuilder buf = new StringBuilder ( chStr . length ( ) + 1 + eventName . length ( ) + 4 ) ; buf . append ( chStr ) . append ( ' ' ) . append ( eventName ) . append ( ": 0B" ) ; return buf . toString ( ) ; } else { int rows = length / 16 + ( length % 15 == 0 ? 0 : 1 ) + 4 ; StringBuilder buf = new StringBuilder ( chStr . length ( ) + 1 + eventName . length ( ) + 2 + 10 + 1 + 2 + rows * 80 ) ; buf . append ( chStr ) . append ( ' ' ) . append ( eventName ) . append ( ": " ) . append ( length ) . append ( 'B' ) . append ( NEWLINE ) ; appendPrettyHexDump ( buf , msg ) ; return buf . toString ( ) ; } }
Generates the default log message of the specified event whose argument is a {@link ByteBuf}.