String getEnabledCiphers() {
   StringBuilder sb = new StringBuilder();
   for (Entry e : data) {
     if (e.enabled) {
       sb.append(e.cipher);
       sb.append(',');
     }
   }
   if (sb.length() == 0) {
     return sb.toString();
   } else {
     return sb.substring(0, sb.length() - 1);
   }
 }
    /**
     * Appends the XML <tt>String</tt> representation of this <tt>Content</tt> to a specific
     * <tt>StringBuilder</tt>.
     *
     * @param xml the <tt>StringBuilder</tt> to which the XML <tt>String</tt> representation of this
     *     <tt>Content</tt> is to be appended
     */
    public void toXML(StringBuilder xml) {
      xml.append('<').append(ELEMENT_NAME);
      xml.append(' ').append(NAME_ATTR_NAME).append("='").append(getName()).append('\'');

      List<Channel> channels = getChannels();
      List<SctpConnection> connections = getSctpConnections();

      if (channels.size() == 0 && connections.size() == 0) {
        xml.append(" />");
      } else {
        xml.append('>');
        for (Channel channel : channels) channel.toXML(xml);
        for (SctpConnection conn : connections) conn.toXML(xml);
        xml.append("</").append(ELEMENT_NAME).append('>');
      }
    }
    @Override
    protected void printAttributes(StringBuilder xml) {
      // direction
      MediaDirection direction = getDirection();

      if ((direction != null) && (direction != MediaDirection.SENDRECV)) {
        xml.append(' ')
            .append(DIRECTION_ATTR_NAME)
            .append("='")
            .append(direction.toString())
            .append('\'');
      }

      // host
      String host = getHost();

      if (host != null) {
        xml.append(' ').append(HOST_ATTR_NAME).append("='").append(host).append('\'');
      }

      // id
      String id = getID();

      if (id != null) {
        xml.append(' ').append(ID_ATTR_NAME).append("='").append(id).append('\'');
      }

      // lastN
      Integer lastN = getLastN();

      if (lastN != null) {
        xml.append(' ').append(LAST_N_ATTR_NAME).append("='").append(lastN).append('\'');
      }

      // rtcpPort
      int rtcpPort = getRTCPPort();

      if (rtcpPort > 0) {
        xml.append(' ').append(RTCP_PORT_ATTR_NAME).append("='").append(rtcpPort).append('\'');
      }

      // rtpLevelRelayType
      RTPLevelRelayType rtpLevelRelayType = getRTPLevelRelayType();

      if (rtpLevelRelayType != null) {
        xml.append(' ')
            .append(RTP_LEVEL_RELAY_TYPE_ATTR_NAME)
            .append("='")
            .append(rtpLevelRelayType)
            .append('\'');
      }

      // rtpPort
      int rtpPort = getRTPPort();

      if (rtpPort > 0) {
        xml.append(' ').append(RTP_PORT_ATTR_NAME).append("='").append(rtpPort).append('\'');
      }
    }
    @Override
    protected void printContent(StringBuilder xml) {
      List<PayloadTypePacketExtension> payloadTypes = getPayloadTypes();
      List<SourcePacketExtension> sources = getSources();
      int[] ssrcs = getSSRCs();

      for (PayloadTypePacketExtension payloadType : payloadTypes) xml.append(payloadType.toXML());

      for (SourcePacketExtension source : sources) xml.append(source.toXML());

      for (int i = 0; i < ssrcs.length; i++) {
        xml.append('<')
            .append(SSRC_ELEMENT_NAME)
            .append('>')
            .append(Long.toString(ssrcs[i] & 0xFFFFFFFFL))
            .append("</")
            .append(SSRC_ELEMENT_NAME)
            .append('>');
      }
    }
  /**
   * Returns an XML <tt>String</tt> representation of this <tt>IQ</tt>.
   *
   * @return an XML <tt>String</tt> representation of this <tt>IQ</tt>
   */
  @Override
  public String getChildElementXML() {
    StringBuilder xml = new StringBuilder();

    xml.append('<').append(ELEMENT_NAME);
    xml.append(" xmlns='").append(NAMESPACE).append('\'');

    String id = getID();

    if (id != null) xml.append(' ').append(ID_ATTR_NAME).append("='").append(id).append('\'');

    List<Content> contents = getContents();

    if (contents.size() == 0) {
      xml.append(" />");
    } else {
      xml.append('>');
      for (Content content : contents) content.toXML(xml);
      xml.append("</").append(ELEMENT_NAME).append('>');
    }
    return xml.toString();
  }
    /**
     * Appends the XML <tt>String</tt> representation of this <tt>Channel</tt> to a specific
     * <tt>StringBuilder</tt>.
     *
     * @param xml the <tt>StringBuilder</tt> to which the XML <tt>String</tt> representation of this
     *     <tt>Channel</tt> is to be appended
     */
    public void toXML(StringBuilder xml) {
      xml.append('<').append(elementName);

      // endpoint
      String endpoint = getEndpoint();

      if (endpoint != null) {
        xml.append(' ').append(ENDPOINT_ATTR_NAME).append("='").append(endpoint).append('\'');
      }

      // expire
      int expire = getExpire();

      if (expire >= 0) {
        xml.append(' ').append(EXPIRE_ATTR_NAME).append("='").append(expire).append('\'');
      }

      // initiator
      Boolean initiator = isInitiator();

      if (initiator != null) {
        xml.append(' ').append(INITIATOR_ATTR_NAME).append("='").append(initiator).append('\'');
      }

      // Print derived class attributes
      printAttributes(xml);

      IceUdpTransportPacketExtension transport = getTransport();
      boolean hasTransport = (transport != null);
      if (hasTransport || hasContent()) {
        xml.append('>');
        if (hasContent()) printContent(xml);
        if (hasTransport) xml.append(transport.toXML());
        xml.append("</").append(elementName).append('>');
      } else {
        xml.append(" />");
      }
    }
 /** {@inheritDoc} */
 @Override
 protected void printAttributes(StringBuilder xml) {
   xml.append(' ').append(PORT_ATTR_NAME).append("='").append(getPort()).append('\'');
 }