/** * 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('>'); } }
/** * Gets a <tt>Channel</tt> which is included into this <tt>Content</tt> and which has a specific * ID. * * @param channelID the ID of the <tt>Channel</tt> included into this <tt>Content</tt> to be * returned * @return the <tt>Channel</tt> which is included into this <tt>Content</tt> and which has the * specified <tt>channelID</tt> if such a <tt>Channel</tt> exists; otherwise, <tt>null</tt> */ public Channel getChannel(String channelID) { for (Channel channel : getChannels()) if (channelID.equals(channel.getID())) return channel; return null; }