Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tcptype to Candidate toString method #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/main/java/org/ice4j/ice/Candidate.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -776,6 +787,10 @@ public String toString()
buff.append(" rport ").append(relAddr.getPort());
}

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

return buff.toString();
}

Expand Down
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
Expand Up @@ -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();
}

/**
Expand Down