Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * Conditions Of Use
  *
  * This software was developed by employees of the National Institute of
  * Standards and Technology (NIST), an agency of the Federal Government.
  * Pursuant to title 15 Untied States Code Section 105, works of NIST
  * employees are not subject to copyright protection in the United States
  * and are considered to be in the public domain.  As a result, a formal
  * license is not needed to use the software.
 *
 * This software is provided by NIST as a service and is expressly
 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
 * AND DATA ACCURACY.  NIST does not warrant or make any representations
 * regarding the use of the software or the results thereof, including but
 * not limited to the correctness, accuracy, reliability or usefulness of
 * the software.
 *
 * Permission to use this software is contingent upon your acceptance
 * of the terms of this agreement
 *
 * .
 *
 */
Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * /
 
 package gov.nist.javax.sip.header;

The call identifer that goes into a callID header and a in-reply-to header.

Author(s):
M. Ranganathan
Version:
1.2 $Revision: 1.7 $ $Date: 2009/12/16 02:38:35 $
Since:
1.1
See also:
CallID
InReplyTo
 
 public final class CallIdentifier extends SIPObject {

    
Comment for serialVersionUID
 
     private static final long serialVersionUID = 7314773655675451377L;

    
localId field
 
     protected String localId;

    
host field
 
     protected String host;

    
Default constructor
 
     public CallIdentifier() {
     }

    
Constructor

Parameters:
localId id is the local id.
host is the host.
 
     public CallIdentifier(String localIdString host) {
         this. = localId;
         this. = host;
     }

    
constructor

Parameters:
cid String to set
Throws:
java.lang.IllegalArgumentException if cid is null or is not a token, or token@token
 
     public CallIdentifier(String cidthrows IllegalArgumentException {
         setCallID(cid);
     }

    
Get the encoded version of this id.

Returns:
String to set
 
     public String encode() {
         return encode(new StringBuffer()).toString();
     }
 
     public StringBuffer encode(StringBuffer buffer) {
         buffer.append();
         if ( != null) {
             buffer.append().append();
         }
         return buffer;
     }

    
Compare two call identifiers for equality.

Parameters:
other Object to set
Returns:
true if the two call identifiers are equals, false otherwise
    public boolean equals(Object other) {
        if (other == null ) return false;
        if (!other.getClass().equals(this.getClass())) {
            return false;
        }
        CallIdentifier that = (CallIdentifierother;
        if (this..compareTo(that.localId) != 0) {
            return false;
        }
        if (this. == that.host)
            return true;
        if ((this. == null && that.host != null)
            || (this. != null && that.host == null))
            return false;
        if (.compareToIgnoreCase(that.host) != 0) {
            return false;
        }
        return true;
    }
    
    @Override
    public int hashCode() {
        if (this.  == null ) {
             throw new UnsupportedOperationException("Hash code called before id is set");
        }
        return this..hashCode();
    }

    
get the LocalId field

Returns:
String
    public String getLocalId() {
        return ;
    }

    
get the host field

Returns:
host member String
    public String getHost() {
        return ;
    }

    
Set the localId member

Parameters:
localId String to set
    public void setLocalId(String localId) {
        this. = localId;
    }

    
set the callId field

Parameters:
cid Strimg to set
Throws:
java.lang.IllegalArgumentException if cid is null or is not a token or token@token
    public void setCallID(String cidthrows IllegalArgumentException {
        if (cid == null)
            throw new IllegalArgumentException("NULL!");
        int index = cid.indexOf('@');
        if (index == -1) {
             = cid;
             = null;
        } else {
             = cid.substring(0, index);
             = cid.substring(index + 1, cid.length());
            if ( == null ||  == null) {
                throw new IllegalArgumentException("CallID  must be token@token or token");
            }
        }
    }

    
Set the host member

Parameters:
host String to set
    public void setHost(String host) {
        this. = host;
    }
New to GrepCode? Check out our FAQ X