MjSip Stack
v1.6

org.zoolu.sip.header
Class MultipleHeader

java.lang.Object
  |
  +--org.zoolu.sip.header.MultipleHeader

public class MultipleHeader
extends java.lang.Object

MultipleHeader can be used to handle SIP headers that support comma-separated (multiple-header) rapresentation, as explaned in section 7.3.1 of RFC 3261.


Field Summary
protected  boolean compact
          whether to be rapresented with a comma-separated(compact) header line or multiple header lines
protected  java.lang.String name
          The header type
protected  java.util.Vector values
          Vector of header values (as Strings)
 
Constructor Summary
protected MultipleHeader()
           
  MultipleHeader(Header hd)
          Costructs a MultipleHeader from a comma-separated header
  MultipleHeader(MultipleHeader mhd)
          Costructs a MultipleHeader from a MultipleHeader
  MultipleHeader(java.lang.String hname)
          Costructs a MultipleHeader named hname
  MultipleHeader(java.lang.String hname, java.util.Vector hvalues)
          Costructs a MultipleHeader named hname from a Vector of header values (as Strings).
  MultipleHeader(java.util.Vector headers)
          Costructs a MultipleHeader from a Vector of Headers.
 
Method Summary
 void addBottom(Header hd)
          Adds bottom
 void addBottom(MultipleHeader mhd)
          Adds other MultipleHeader at bottom
 void addTop(Header hd)
          Adds top
 java.lang.Object clone()
          Creates and returns a copy of Header
 boolean equals(java.lang.Object obj)
          Indicates whether some other Object is "equal to" this Header
 Header getBottom()
          Gets bottom Header
 java.util.Vector getHeaders()
          Gets a vector of headers
 java.lang.String getName()
          Gets name of Header
 Header getTop()
          Gets top Header
 java.lang.String getValue(int i)
          Gets the i-value
 java.util.Vector getValues()
          Gets a vector of header values
 boolean isCommaSeparated()
          Whether the MultipleHeader rappresentation is comma-separated or multiple headers
static boolean isCommaSeparated(Header hd)
          Checks if Header hd contains comma-separated multi-header
 boolean isEmpty()
          Whether it is empty
 void removeBottom()
          Removes bottom Header
 void removeTop()
          Removes top Header
 void setCommaSeparated(boolean comma_separated)
          Sets the MultipleHeader rappresentation as comma-separated or multiple headers
 void setHeaders(java.util.Vector hdv)
          Sets header values
 void setValues(java.util.Vector v)
          Sets header values
 int size()
          Gets the size of th MultipleHeader
 Header toHeader()
          Gets an Header containing the comma-separated(compact) representation.
 java.lang.String toString()
          Gets comma-separated(compact) or multi-headers(extended) representation.
Note that an empty header is rapresentated as:
- empty String (i.e.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The header type

values

protected java.util.Vector values
Vector of header values (as Strings)

compact

protected boolean compact
whether to be rapresented with a comma-separated(compact) header line or multiple header lines
Constructor Detail

MultipleHeader

protected MultipleHeader()

MultipleHeader

public MultipleHeader(java.lang.String hname)
Costructs a MultipleHeader named hname

MultipleHeader

public MultipleHeader(java.lang.String hname,
                      java.util.Vector hvalues)
Costructs a MultipleHeader named hname from a Vector of header values (as Strings).

MultipleHeader

public MultipleHeader(java.util.Vector headers)
Costructs a MultipleHeader from a Vector of Headers. Each Header can be a single header or a multiple-comma-separated header.

MultipleHeader

public MultipleHeader(Header hd)
Costructs a MultipleHeader from a comma-separated header

MultipleHeader

public MultipleHeader(MultipleHeader mhd)
Costructs a MultipleHeader from a MultipleHeader
Method Detail

isCommaSeparated

public static boolean isCommaSeparated(Header hd)
Checks if Header hd contains comma-separated multi-header

setCommaSeparated

public void setCommaSeparated(boolean comma_separated)
Sets the MultipleHeader rappresentation as comma-separated or multiple headers

isCommaSeparated

public boolean isCommaSeparated()
Whether the MultipleHeader rappresentation is comma-separated or multiple headers

size

public int size()
Gets the size of th MultipleHeader

isEmpty

public boolean isEmpty()
Whether it is empty

clone

public java.lang.Object clone()
Creates and returns a copy of Header
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other Object is "equal to" this Header
Overrides:
equals in class java.lang.Object

getName

public java.lang.String getName()
Gets name of Header

getValues

public java.util.Vector getValues()
Gets a vector of header values

setValues

public void setValues(java.util.Vector v)
Sets header values

getHeaders

public java.util.Vector getHeaders()
Gets a vector of headers

setHeaders

public void setHeaders(java.util.Vector hdv)
Sets header values

getValue

public java.lang.String getValue(int i)
Gets the i-value

addTop

public void addTop(Header hd)
Adds top

getTop

public Header getTop()
Gets top Header

removeTop

public void removeTop()
Removes top Header

addBottom

public void addBottom(Header hd)
Adds bottom

addBottom

public void addBottom(MultipleHeader mhd)
Adds other MultipleHeader at bottom

getBottom

public Header getBottom()
Gets bottom Header

removeBottom

public void removeBottom()
Removes bottom Header

toHeader

public Header toHeader()
Gets an Header containing the comma-separated(compact) representation.

toString

public java.lang.String toString()
Gets comma-separated(compact) or multi-headers(extended) representation.
Note that an empty header is rapresentated as:
- empty String (i.e. ""), for multi-headers(extended) rapresentation, - empty-value Header (i.e. "HeaderName: \r\n"), for comma-separated(compact) rapresentation.
Overrides:
toString in class java.lang.Object

MjSip Stack
v1.6