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

ConnectionField

public class ConnectionField extends SDPField
Connectin Field of the SDP request.
version
JSR141-PUBLIC-REVIEW (subject to change). This code is in the public domain.

Fields Summary
protected String
nettype
Network type.
protected String
addrtype
Address type.
protected ConnectionAddress
address
Connection address.
Constructors Summary
public ConnectionField()
Default constructor.

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

return
the copy of this object

	ConnectionField retval = new ConnectionField();
	retval.nettype = this.nettype;
	retval.addrtype = this.addrtype;
	if (this.address != null) 
	    retval.address = (ConnectionAddress)
		this.address.clone();
	return retval;
    
public java.lang.Stringencode()
Gets the string encoded version of this object.

return
the encoded text string of this object contents
since
v1.0

	String encoded_string = CONNECTION_FIELD;
	if (nettype != null) encoded_string += nettype;
	if (addrtype != null) encoded_string += Separators.SP + addrtype;
	if (address != null) encoded_string += Separators.SP + 
	    address.encode();
	return encoded_string += Separators.NEWLINE;
    
public java.lang.StringgetAddress()
Returns the type of the network for this Connection.

throws
SdpParseException if a parsing error occurs
return
the type of the network

	ConnectionAddress connectionAddress = getConnectionAddress();
	if (connectionAddress == null)
	    return null;
	else { 
	    Host host = connectionAddress.getAddress();
	    if (host == null)
		return null;
	    else return host.getAddress();
	}
    
public java.lang.StringgetAddressType()
Returns the type of the address for this Connection.

throws
SdpParseException if a parsing error occurs
return
the type of the address

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

return
the address type

	return addrtype;
    
public ConnectionAddressgetConnectionAddress()
Gets the network connection address.

return
the connection address

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

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 type of the network

	return getNettype();
    
public voidsetAddrType(java.lang.String a)
Sets the address type member.

param
a the new address type

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

param
addr to set
throws
SdpException if the type is null

	if (addr == null)
	    throw new SdpException("the addr is null");
	else {
	    if (address == null) {
		address = new ConnectionAddress();
		Host host = new Host(addr);
		address.setAddress(host);
	    } else {
		Host host = address.getAddress();
		if (host == null) {
		    host = new Host(addr);
		    address.setAddress(host);
		} else
		    host.setAddress(addr);
	    }
	    setAddress(address);
	}
    
public voidsetAddress(ConnectionAddress a)
Sets the address member.

param
a the new connectio address

	address = a;
    
public voidsetAddressType(java.lang.String type)
Returns the type of the network for this Connection.

param
type to set
throws
SdpException if the type is null

	if (type == null) 
	    throw new SdpException("the type is null");
	this.addrtype = type;
    
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 to set
throws
SdpException if the type is null

	if (type == null)
	    throw new SdpException("the type is null");
	else setNettype(type);
    
public java.lang.StringtoString()
Encodes contents as a textstring.

return
encoded string of object contents

 return this.encode();