Package be.demmel.jgws.packets.serialization

Examples of be.demmel.jgws.packets.serialization.PacketSerializer


    ByteBuf buffer = Unpooled.buffer(256);
    // Bytes leave in little endian order (the first byte being the least significant)
    buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
    // Find the correct PacketMarshaller for this packet (using the unique class name)
    Class<? extends Packet> outgoingPacketClass = packet.getClass();
    PacketSerializer foundPacketMarshaller = packetMarshallers.get(outgoingPacketClass);
    // If the PacketMarshaller corresponding to the class cannot be found, processing cannot continue
    if (foundPacketMarshaller == null) {
      String msg = "No suitable PacketSerializer was found for packet: " + outgoingPacketClass;
      LOGGER.error(msg);
      throw new IllegalStateException(msg);
    }

    // Use the PacketMarshaller to fill the ByteBuffer with the data from this packet instance
    foundPacketMarshaller.serialize(packet, buffer);
   
    if(LOGGER.isInfoEnabled() && !this.logBlackList.contains(outgoingPacketClass)) {
      LOGGER.info("Packet: {}", packet);
    }
View Full Code Here


    for (Class<? extends Packet> packetClass : packetClasses) {
      LOGGER.info("Creating serializer for packet class: {}", packetClass);

      int header = extractHeader(packetClass);

      PacketSerializer packetSerializer = packetSerializers.get(packetClass);

      if (packetSerializer == null) {
        packetSerializer = new ReflectionPacketSerializer(header, packetClass);
        packetSerializers.put(packetClass, packetSerializer);
      } else {
View Full Code Here

TOP

Related Classes of be.demmel.jgws.packets.serialization.PacketSerializer

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.