com.witjit.game.server.communication.bbmessage.MessageInHandler.java Source code

Java tutorial

Introduction

Here is the source code for com.witjit.game.server.communication.bbmessage.MessageInHandler.java

Source

/*
 * Here comes the text of your license
 * Each line should be prefixed with  * 
 */
package com.witjit.game.server.communication.bbmessage;

import com.witjit.game.server.communication.core.MessageDispatcher;
import com.witjit.game.server.communication.netty.handler.AbstractMessageInHandler;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 *
 * @author Administrator
 */
public class MessageInHandler extends AbstractMessageInHandler<ByteBuf> {

    public MessageInHandler(MessageDispatcher<ByteBuf> messageDispatcher) {
        super(messageDispatcher);
    }

    @Override
    protected long readEndpointId(ByteBuf mb) {
        return mb.readLong();
    }

    @Override
    protected ByteBuf readMessage(ByteBuf mb) {
        ByteBuf buffer = Unpooled.buffer(128);
        mb.readBytes(buffer);
        return buffer;
    }

}