FileDocCategorySizeDatePackage
OriginField.javaAPI DocphoneME MR2 API (J2ME)7904Wed May 02 18:00:42 BST 2007gov.nist.javax.sdp.fields

OriginField

public class OriginField extends SDPField
Origin Field SDP header This code is in the public domain.

Fields Summary
protected String
username
User name.
protected long
sessId
Session identifier.
protected long
sessVersion
Session version number.
protected String
nettype
Network type.
protected String
addrtype
Address type.
protected Host
address
Target host address.
Constructors Summary
public OriginField()
Default constructor.

	super(ORIGIN_FIELD);
    
Methods Summary
public java.lang.Objectclone()
Copies the current instance.

return
the copy of this object

	OriginField retval = new OriginField();
	retval.username = this.username;
	retval.sessId = this.sessId;
	retval.sessVersion = this.sessVersion;
	retval.nettype = this.nettype;
	retval.addrtype = this.addrtype;
	if (this.address != null) 
	    retval.address = (Host) this.address.clone();
	return retval;
    
public java.lang.Stringencode()
Gets the string encoded version of this object.

return
encode string of object contents
since
v1.0

	return ORIGIN_FIELD + username + Separators.SP 
	    + sessId + Separators.SP
	    + sessVersion + Separators.SP
	    + nettype + Separators.SP
	    + addrtype + Separators.SP
	    + address.encode() + Separators.NEWLINE;
    
public java.lang.StringgetAddress()
Returns the type of the network for this Connection.

throws
SdpParseException if a parsing error occurs
return
the string network type.

	Host addr = getHost(); 
	if (addr == null)
	    return null;
	else return addr.getAddress();
    
public java.lang.StringgetAddressType()
Returns the type of the address for this Connection.

throws
SdpParseException if a parsing error occurs
return
the string address type.

	return getAddrtype();
    
public java.lang.StringgetAddrtype()
Gets the address type member.

return
the target address

	return addrtype;
    
public HostgetHost()
Gets the host member.

return
the host

	return address;
    
public java.lang.StringgetNettype()
Gets the network type member.

return
the network type

	return nettype;
    
public java.lang.StringgetNetworkType()
Returns the type of the network for this Connection

throws
SdpParseException if a parsing error occurs
return
the string network type.

	return getNettype();
    
public longgetSessId()
Gets the session identifier member.

return
the session identifier

	return sessId;
    
public longgetSessVersion()
Gets the session version member.

return
the session version number

	return sessVersion;
    
public longgetSessionId()
Returns the unique identity of the session.

throws
SdpParseException if a parsing error occurs
return
the session id.

	return getSessId(); 
    
public longgetSessionVersion()
Returns the unique version of the session.

throws
SdpException if the session version is not set
return
the session version.

	return getSessVersion();
    
public java.lang.StringgetUsername()
Returns the name of the session originator.

throws
SdpParseException
return
the string username.

	return username; 
    
public voidsetAddress(Host a)
Sets the address member.

param
a the new address

	address = a;
    
public voidsetAddress(java.lang.String addr)
Sets the type of the address for this Connection.

param
addr string address type.
throws
SdpException if the addr is null

	if (addr == null)
	    throw new SdpException("The addr parameter is null");
	else {
	    Host host = getHost(); 
	    if (host == null)
		host = new Host();
	    host.setAddress(addr);
	    setAddress(host);
	}
    
public voidsetAddressType(java.lang.String type)
Returns the type of the network for this Connection.

param
type the string network type.
throws
SdpException if the type is null

	if (type == null)
	    throw new SdpException("The type parameter is < 0");
	else
	    setAddrtype(type);
    
public voidsetAddrtype(java.lang.String a)
Sets the address type member.

param
a the new address type

	addrtype = a;
    
public voidsetNettype(java.lang.String n)
Sets the network type member.

param
n the new network type

	nettype = n;
    
public voidsetNetworkType(java.lang.String type)
Sets the type of the network for this Connection.

param
type the string network type.
throws
SdpException if the type is null

	if (type == null)
	    throw new SdpException("The type parameter is < 0");
	else setNettype(type);
    
public voidsetSessId(long s)
Sets the session identifier member.

param
s the new session identifier

	sessId = s;
    
public voidsetSessVersion(long s)
Sets the session version member.

param
s the new session version number

	sessVersion = s;
    
public voidsetSessionId(long id)
Sets the unique identity of the session.

param
id the session id.
throws
SdpException if the id is less than 0

	if (id < 0)
	    throw new SdpException("The is parameter is < 0");
	else
	    setSessId(id);
    
public voidsetSessionVersion(long version)
Sets the unique version of the session.

param
version the session version.
throws
SdpException if the version is less than 0

	if (version < 0) 
	    throw new SdpException("The version parameter is < 0");
	else
	    setSessVersion(version);
    
public voidsetUsername(java.lang.String user)
Sets the name of the session originator.

param
user the string username.
throws
SdpException if the parameter is null

	if (user == null)
	    throw new SdpException("The user parameter is null");
	else {
	    this.username = user;
	}