Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tcptype to Candidate toString method
Browse files Browse the repository at this point in the history
Also, remove redundancy in generatig candidate SDP attribute strings.
jalaziz committed Oct 19, 2017

Verified

This commit was signed with the committer’s verified signature.
jalaziz Jameel Al-Aziz
1 parent c266797 commit 0a12d4d
Showing 2 changed files with 17 additions and 24 deletions.
17 changes: 16 additions & 1 deletion src/main/java/org/ice4j/ice/Candidate.java
Original file line number Diff line number Diff line change
@@ -758,7 +758,18 @@ public TransportAddress getRelatedAddress()
@Override
public String toString()
{
StringBuilder buff = new StringBuilder("candidate:");
return "candidate:" + toAttributeValue();
}

/**
* Returns a <tt>String</tt> represnation of this <tt>Candidate</tt>
* suitable for use as an SDP attribute value.
*
* @return a <tt>String</tt> representing th SDP attribute value of this
* <tt>Candidate</tt>.
*/
public String toAttributeValue() {
StringBuilder buff = new StringBuilder();

buff.append(getFoundation());
buff.append(" ").append(getParentComponent().getComponentID());
@@ -776,6 +787,10 @@ public String toString()
buff.append(" rport ").append(relAddr.getPort());
}

if(getTcpType() != null) {
buff.append(" tcptype ").append(getTcpType());
}

return buff.toString();
}

24 changes: 1 addition & 23 deletions src/main/java/org/ice4j/ice/sdp/CandidateAttribute.java
Original file line number Diff line number Diff line change
@@ -115,29 +115,7 @@ public boolean hasValue()
*/
public String getValue()
{
StringBuffer buff = new StringBuffer();

buff.append(candidate.getFoundation());
buff.append(" ").append(
candidate.getParentComponent().getComponentID());
buff.append(" ").append(candidate.getTransport());
buff.append(" ").append(candidate.getPriority());
buff.append(" ").append(
candidate.getTransportAddress().getHostAddress());
buff.append(" ").append(
candidate.getTransportAddress().getPort());
buff.append(" typ ").append(
candidate.getType());

TransportAddress relAddr = candidate.getRelatedAddress();

if (relAddr != null)
{
buff.append(" raddr ").append(relAddr.getHostAddress());
buff.append(" rport ").append(relAddr.getPort());
}

return buff.toString();
return candidate.toAttributeValue();
}

/**

0 comments on commit 0a12d4d

Please sign in to comment.