Package com.github.xgameenginee.core

Examples of com.github.xgameenginee.core.ProtocolCoder


    public void broadcast(GameDownBuffer buffer) throws Exception {
        if (buffer.getChannelBuffer().writable()) {
            throw new IllegalStateException("write bytes not be filled full! type = " + buffer.getChannelBuffer().getShort(2));
        }

        ProtocolCoder coder = GameBoss.getInstance().getProtocolCoder();
        if (coder != null) {
            coder.encode(buffer.getChannelBuffer().array(), GameBoss.getInstance().getWriteHeaderSize());
        }
        channel.write(buffer.getChannelBuffer());
    }
View Full Code Here


    }

    @Override
    protected Object decode(ChannelHandlerContext ctx, Channel ch, ChannelBuffer cb) throws Exception {
        ChannelBuffer buffer = (ChannelBuffer) super.decode(ctx, ch, cb);
        ProtocolCoder coder = GameBoss.getInstance().getProtocolCoder();
        if (coder != null && buffer != null) {
            byte[] decodebytes = coder.decode(buffer.array());
            return ChannelBuffers.wrappedBuffer(decodebytes);
        }
        return buffer;
    }
View Full Code Here

TOP

Related Classes of com.github.xgameenginee.core.ProtocolCoder

Copyright © 2018 www.massapicom. 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.