FileDocCategorySizeDatePackage
StatusLine.javaAPI DocphoneME MR2 API (J2ME)5366Wed May 02 18:00:42 BST 2007gov.nist.siplite.header

StatusLine

public final class StatusLine extends GenericObject
Status Line (for SIPReply) messages.
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
protected String
sipVersion
SipVersion field.
protected int
statusCode
Status code field.
protected String
reasonPhrase
Reason phrase field.
public static Class
clazz
Class handle.
Constructors Summary
public StatusLine()
Default Constructor.

        reasonPhrase = null;
        sipVersion = SIPConstants.SIP_VERSION_STRING;
    
Methods Summary
public java.lang.Objectclone()
Copies the current instance.

return
copy of the current objectt

        StatusLine retval = new StatusLine();
        
        if (this.sipVersion != null)
            retval.sipVersion = new String(this.sipVersion);
        
        retval.statusCode = this.statusCode;
        
        if (this.reasonPhrase != null)
            retval.reasonPhrase = new String(this.reasonPhrase);
        
        return retval;
        
    
public java.lang.Stringencode()
Encodes into a canonical form.

return
String

        clazz = new StatusLine().getClass();
    
        String encoding = SIPConstants.SIP_VERSION_STRING + Separators.SP +
                statusCode;
        if (reasonPhrase != null) encoding += Separators.SP + reasonPhrase;
        encoding += Separators.NEWLINE;
        return encoding;
    
public booleanequals(java.lang.Object that)
Compares this instance to the requested object.

param
that object for comparison
return
true if the object matches.

        if (that instanceof StatusLine)
            return this.statusCode == ((StatusLine)that).statusCode;
        else return false;
    
public java.lang.StringgetReasonPhrase()
Gets the ReasonPhrase field.

return
ReasonPhrase field

        return reasonPhrase;
    
public java.lang.StringgetSipVersion()
Gets the Sip Version.

return
SipVersion

        return sipVersion;
    
public intgetStatusCode()
Gets the Status Code.

return
StatusCode

        return statusCode;
    
public java.lang.StringgetVersionMajor()
Gets the major version number.

return
String major version number

        if (sipVersion == null)
            return null;
        String major = null;
        boolean slash = false;
        for (int i = 0; i < sipVersion.length(); i++) {
            if (sipVersion.charAt(i) == '.") slash = false;
            if (slash) {
                if (major == null)
                    major = "" + sipVersion.charAt(i);
                else major += sipVersion.charAt(i);
            }
            if (sipVersion.charAt(i) == '/") slash = true;
        }
        return major;
    
public java.lang.StringgetVersionMinor()
Gets the minor version number.

return
String minor version number

        if (sipVersion == null)
            return null;
        String minor = null;
        boolean dot = false;
        for (int i = 0; i < sipVersion.length(); i++) {
            if (dot) {
                if (minor == null)
                    minor = "" + sipVersion.charAt(i);
                else minor += sipVersion.charAt(i);
            }
            if (sipVersion.charAt(i) == '.") dot = true;
        }
        return minor;
    
public voidsetReasonPhrase(java.lang.String reasonPhrase)
Set the reasonPhrase member.

param
reasonPhrase String to set

        this.reasonPhrase = reasonPhrase;
    
public voidsetSipVersion(java.lang.String s)
Sets the sipVersion member.

param
s String to set

        sipVersion = s;
    
public voidsetStatusCode(int statusCode)
Sets the statusCode member.

param
statusCode int to set

        this.statusCode = statusCode;