Package gwlpr.protocol.serialization

Examples of gwlpr.protocol.serialization.NettySerializationFilter


    }


    public void serializeInto(ByteBuf buffer)
    {
        NettySerializationFilter filter = getFilter(P001_ServerSeed.class);
        filter.serialize(buffer, this);
    }
View Full Code Here


           
            // failcheck
            if (messageClazz == null) { buf.resetReaderIndex(); return; }
           
            // try retrieve the serialization filter
            NettySerializationFilter filter = GWMessageSerializationRegistry.getFilter(messageClazz);
           
            // failcheck
            if (filter == null) { buf.resetReaderIndex(); return; }
           
            // try create the message
            Message message;
            try
            {
                message = messageClazz.newInstance();
            }
            catch (InstantiationException | IllegalAccessException ex)
            {
                LOGGER.error("Could not create an instance of an message.", ex);
               
                buf.resetReaderIndex();
                return;
            }
           
            // dont forget to initialize the message
            message.init(ctx.channel());
           
            // try serialize the message
            if (!filter.deserialize(buf, message))
            {
                buf.resetReaderIndex();
                return;
            }
           
View Full Code Here

       
        GWMessage gwact = message;
        int header = gwact.getHeader();

        // try retrieve the serialization filter
        NettySerializationFilter filter = GWMessageSerializationRegistry.getFilter(gwact.getClass());
       
        if (filter == null)
        {
            LOGGER.error("Could not find a filter for given message.");
            return;
        }
       
        // write the header
        result.writeShort(header);

        // serialize the message
        filter.serialize(result, message);
    }
View Full Code Here

TOP

Related Classes of gwlpr.protocol.serialization.NettySerializationFilter

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.