net.sourceforge.jsdp
Class Bandwith

java.lang.Object
  extended by net.sourceforge.jsdp.Bandwith
All Implemented Interfaces:
Serializable, Cloneable, Field

public class Bandwith
extends Object
implements Field

A Bandwith represents an b=<field value> field contained in a SDP message.

A bandwith field specifies the proposed bandwidth to be used by the session or media, and is optional. Multiple bandwidth specifiers of different types may be associated with the same SessionDescription. Each has the form b=<modifier>:<value>. There are four bandwith modifers (or types):

Since:
0.1.0
Version:
1.0
Author:
Claudio Di Vita
See Also:
Serialized Form

Field Summary
static String AS
          The AS modifier
static String CT
          The CT modifier
protected  String modifier
          The bandwith modifier
static String RR
          The RR modifier
static String RS
          The RS modifier
protected  int value
          The bandwith value, in kbits/second
 
Fields inherited from interface net.sourceforge.jsdp.Field
ATTRIBUTE_FIELD, BANDWITH_FIELD, CONNECTION_FIELD, EMAIL_FIELD, END_OF_FIELD, INFORMATION_FIELD, KEY_FIELD, MEDIA_FIELD, ORIGIN_FIELD, PHONE_FIELD, REPEAT_TIME_FIELD, SESSION_NAME_FIELD, TIME_FIELD, TIMEZONE_FIELD, URI_FIELD, VERSION_FIELD
 
Constructor Summary
protected Bandwith()
          Creates a new Bandwith.
  Bandwith(String modifier, int value)
          Creates a new Bandwith.
 
Method Summary
 Object clone()
          Returns a clone of this field.
 String getModifier()
          Returns the bandwith modifier.
 char getType()
          Returns the type character for the field.
 int getValue()
          Returns the bandwith value.
static Bandwith parse(String field)
          Parse an input string and constructs the equivalent bandwith field.
 void setModifier(String modifier)
          Sets the bandwith modifier.
 void setValue(int value)
          Sets the bandwith value.
 String toString()
          Returns a string representation of the field.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AS

public static final String AS
The AS modifier

See Also:
Constant Field Values

CT

public static final String CT
The CT modifier

See Also:
Constant Field Values

RS

public static final String RS
The RS modifier

See Also:
Constant Field Values

RR

public static final String RR
The RR modifier

See Also:
Constant Field Values

modifier

protected String modifier
The bandwith modifier


value

protected int value
The bandwith value, in kbits/second

Constructor Detail

Bandwith

protected Bandwith()
Creates a new Bandwith.


Bandwith

public Bandwith(String modifier,
                int value)
         throws SDPException
Creates a new Bandwith.

Parameters:
modifier - the bandwith modifier
value - the bandwith value in kbits/second
Throws:
SDPException - if the modifier is unknown, or the value is negative
Method Detail

parse

public static Bandwith parse(String field)
                      throws SDPParseException
Parse an input string and constructs the equivalent bandwith field.

Parameters:
field - the string to parse
Returns:
a new Bandwith instance
Throws:
SDPParseException - if an error occurs while parsing

clone

public Object clone()
Returns a clone of this field.

Specified by:
clone in interface Field
Overrides:
clone in class Object
Returns:
a clone of this field

getModifier

public String getModifier()
Returns the bandwith modifier.

Returns:
The bandwith modifier.

The allowed modifiers are defined by RFC 2327 and RFC 3556:

  • AS: Application Specific
  • CT: Conference Total
  • RS: RCTP bandwith for data senders
  • RR: RCTP bandwith for data receivers

getType

public char getType()
Returns the type character for the field.

Specified by:
getType in interface Field
Returns:
the field type character: b

getValue

public int getValue()
Returns the bandwith value.

Returns:
the bandwith value in kbits/second

setModifier

public void setModifier(String modifier)
                 throws SDPException
Sets the bandwith modifier.

Parameters:
modifier - the modifier to set
Throws:
SDPException - if the modifier is unknown

setValue

public void setValue(int value)
              throws SDPException
Sets the bandwith value.

Parameters:
value - the value to set
Throws:
SDPException - if value is negative

toString

public String toString()
Returns a string representation of the field. The representation has the form: b=<modifier>:<value>

Specified by:
toString in interface Field
Overrides:
toString in class Object
Returns:
the string representation of the field


Copyright © 2004-2008. All Rights Reserved.