Exemple #1
0
  /**
   * Decodes a packet decoder state into a packet.
   *
   * @param state The packet encoder state to encode.
   * @return The encoded buffer.
   */
  public Packet decode(PacketDecoderState state) {

    /* Check if the decoder map contains a value for the specified decoder */
    int decoderId = state.getDecoderId();
    if (!decoders.containsKey(decoderId)) {
      return null;
    }

    /* Encode the packet decoder state into a packet */
    PacketDecoder encoder = decoders.get(decoderId);
    return encoder.decode(state);
  }