Exemplo n.º 1
0
 public Element toElement() {
   Element element = new Element("candidate");
   element.setAttribute("cid", this.getCid());
   element.setAttribute("host", this.getHost());
   element.setAttribute("port", "" + this.getPort());
   element.setAttribute("jid", this.getJid());
   element.setAttribute("priority", "" + this.getPriority());
   if (this.getType() == TYPE_DIRECT) {
     element.setAttribute("type", "direct");
   } else if (this.getType() == TYPE_PROXY) {
     element.setAttribute("type", "proxy");
   }
   return element;
 }
Exemplo n.º 2
0
 public static JingleCandidate parse(Element candidate) {
   JingleCandidate parsedCandidate = new JingleCandidate(candidate.getAttribute("cid"), false);
   parsedCandidate.setHost(candidate.getAttribute("host"));
   parsedCandidate.setJid(candidate.getAttribute("jid"));
   parsedCandidate.setType(candidate.getAttribute("type"));
   parsedCandidate.setPriority(Integer.parseInt(candidate.getAttribute("priority")));
   parsedCandidate.setPort(Integer.parseInt(candidate.getAttribute("port")));
   return parsedCandidate;
 }