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.sdp.fields;
 import javax.sdp.*;
Connectin Field of the SDP request.

Author(s):
Olivier Deruelle <deruelle@antd.nist.gov>
M. Ranganathan
Version:
JSR141-PUBLIC-REVIEW (subject to change).
 
 public class ConnectionField extends SDPField implements javax.sdp.Connection {
     protected String nettype;
     protected String addrtype;
     protected ConnectionAddress address;
 
     public ConnectionField() {
         super(.);
     }
     public String getNettype() {
         return ;
     }
     public String getAddrtype() {
         return ;
     }
         return ;
     }
    
Set the nettype member
 
     public void setNettype(String n) {
          = n;
     }
    
Set the addrtype member
 
     public void setAddrType(String a) {
          = a;
     }
    
Set the address member
 
     public void setAddress(ConnectionAddress a) {
          = a;
     }
    
Get the string encoded version of this object

Since:
v1.0
 
     public String encode() {
         String encoded_string = ;
         if ( != null)
             encoded_string += ;
         if ( != null)
             encoded_string += . + ;
         if ( != null)
             encoded_string += . + .encode();
         return encoded_string += .;
     }
 
     public String toString() {
         return this.encode();
     }
    
Returns the type of the network for this Connection.

Returns:
the type of the network
Throws:
javax.sdp.SdpParseException
 
    public String getAddress() throws SdpParseException {
        ConnectionAddress connectionAddress = getConnectionAddress();
        if (connectionAddress == null)
            return null;
        else {
            Host host = connectionAddress.getAddress();
            if (host == null)
                return null;
            else
                return host.getAddress();
        }
    }

    
Returns the type of the address for this Connection.

Returns:
the type of the address
Throws:
javax.sdp.SdpParseException
    public String getAddressType() throws SdpParseException {
        return getAddrtype();
    }

    
Returns the type of the network for this Connection.

Returns:
the type of the network
Throws:
javax.sdp.SdpParseException
    public String getNetworkType() throws SdpParseException {
        return getNettype();
    }

    
Sets the type of the address for this Connection.

Parameters:
addr to set
Throws:
javax.sdp.SdpException if the type is null
    public void setAddress(String addrthrows SdpException {
        if (addr == null)
            throw new SdpException("the addr is null");
        else {
            if ( == null) {
                 = new ConnectionAddress();
                Host host = new Host(addr);
                .setAddress(host);
            } else {
                Host host = .getAddress();
                if (host == null) {
                    host = new Host(addr);
                    .setAddress(host);
                } else
                    host.setAddress(addr);
            }
            setAddress();
        }
    }

    
Returns the type of the network for this Connection.

Parameters:
type to set
Throws:
javax.sdp.SdpException if the type is null
    public void setAddressType(String typethrows SdpException {
        if (type == null)
            throw new SdpException("the type is null");
        this. = type;
    }

    
Sets the type of the network for this Connection.

Parameters:
type to set
Throws:
javax.sdp.SdpException if the type is null
    public void setNetworkType(String typethrows SdpException {
        if (type == null)
            throw new SdpException("the type is null");
        else
            setNettype(type);
    }
    public Object clone() {
        ConnectionField retval = (ConnectionFieldsuper.clone();
        if (this. != null)
            retval.address = (ConnectionAddressthis..clone();
        return retval;
    }
New to GrepCode? Check out our FAQ X