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

io.nadron.handlers.netty.NulEncoder Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 0.7
Show newest version
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));
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy