All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jnngl.server.PacketLengthPrefixer Maven / Gradle / Ivy

The newest version!
package com.jnngl.server;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class PacketLengthPrefixer extends MessageToByteEncoder {

    @Override
    protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) {
        BufUtils.writeVarInt(out, msg.readableBytes());
        out.writeBytes(msg);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy