io.nadron.handlers.netty.NulEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nadron Show documentation
Show all versions of nadron Show documentation
Nadron is a high speed socket based java game server written using Netty and Mike Rettig's Jetlang. It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.
package io.nadron.handlers.netty;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
@Sharable
public class NulEncoder extends MessageToByteEncoder {
private static final ByteBuf NULL_BUFFER = Unpooled.wrappedBuffer(new byte[] { 0 });
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
throws Exception {
out.writeBytes(Unpooled.wrappedBuffer(msg,NULL_BUFFER));
}
}