Package net.lightstone.net.codec

Source Code of net.lightstone.net.codec.DestroyEntityCodec

package net.lightstone.net.codec;

import java.io.IOException;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;

import net.lightstone.msg.DestroyEntityMessage;

public final class DestroyEntityCodec extends MessageCodec<DestroyEntityMessage> {

  public DestroyEntityCodec() {
    super(DestroyEntityMessage.class, 0x1D);
  }

  @Override
  public DestroyEntityMessage decode(ChannelBuffer buffer) throws IOException {
    int id = buffer.readInt();
    return new DestroyEntityMessage(id);
  }

  @Override
  public ChannelBuffer encode(DestroyEntityMessage message) throws IOException {
    ChannelBuffer buffer = ChannelBuffers.buffer(4);
    buffer.writeInt(message.getId());
    return buffer;
  }

}
TOP

Related Classes of net.lightstone.net.codec.DestroyEntityCodec

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.