Methods Summary |
---|
public void | add(java.lang.Object sipHeader)Adds a new element.
if (headerName != null) {
String expandedName1 = NameMap.expandHeaderName(headerName);
String expandedName2 = NameMap.expandHeaderName(
((Header)sipHeader).getHeaderName());
if (!expandedName1.equalsIgnoreCase(expandedName2)) {
throw new IllegalArgumentException("bad type");
}
}
if (sipHeader != null)
sipHeaderVector.addElement(sipHeader);
|
public void | addFirst(java.lang.Object sipHeader)Adds a new element on the top of the list.
if (sipHeader != null) {
Vector vec = new Vector();
vec.addElement(sipHeader);
for (int i = 0; i < sipHeaderVector.size(); i++) {
vec.addElement(sipHeaderVector.elementAt(i));
}
sipHeaderVector = vec;
}
|
public java.lang.Object | clone()Copies the current instance.
try {
HeaderList retval =
(HeaderList)this.getClass().newInstance();
if (this.headerName != null)
retval.headerName = new String(this.headerName);
if (this.headerValue != null)
retval.headerValue = new String(this.headerValue);
retval.sipHeaderVector = new Vector();
for (int i = 0; i < sipHeaderVector.size(); i ++) {
Header siphdr = (Header) sipHeaderVector.elementAt(i);
Header newHdr = (Header) siphdr.clone();
retval.sipHeaderVector.addElement(newHdr);
}
return (Object) retval;
} catch (Exception ex) {
ex.printStackTrace();
System.out.print("Problem with clone method");
System.exit(0);
return null;
}
|
public void | concatenate(gov.nist.siplite.header.HeaderList other, boolean top)Concatenates two compatible lists. This appends or prepends the new list
to the end of this list.
if (other != null) {
if (top) {
for (int i = 0; i < size(); i++) {
Header sipHeader = (Header)elementAt(i);
other.add(sipHeader);
}
} else {
for (int i = 0; i < other.size(); i++) {
Header sipHeader = (Header)other.elementAt(i);
add(sipHeader);
}
}
}
|
public java.lang.Object | elementAt(int i)Returns the element at the position i.
return sipHeaderVector.elementAt(i);
|
public java.lang.String | encode()Encodes the contents as a string.
if (sipHeaderVector.isEmpty() || headerName == null)
return "";
StringBuffer encoding = new StringBuffer();
// The following headers do not have comma separated forms for
// multiple headers. Thus, they must be encoded separately.
if (this.headerName.equals(WWW_AUTHENTICATE) ||
this.headerName.equals(PROXY_AUTHENTICATE) ||
this.headerName.equals(AUTHORIZATION) ||
this.headerName.equals(PROXY_AUTHORIZATION)) {
for (int i = 0; i < sipHeaderVector.size(); i++) {
Header sipheader =
(Header) sipHeaderVector.elementAt(i);
encoding.append(sipheader.encode());
}
return encoding.toString();
} else {
// These can be concatenated together in an comma separated
// list.
return headerName + Separators.COLON + Separators.SP +
this.encodeBody() + Separators.NEWLINE;
}
|
protected java.lang.String | encodeBody()Encodes body as a string.
StringBuffer sbuf = new StringBuffer();
for (int i = 0; i < sipHeaderVector.size(); i++) {
Header sipHeader =
(Header) sipHeaderVector.elementAt(i);
sbuf.append(sipHeader.encodeBody());
if (i + 1 < sipHeaderVector.size())
sbuf.append(",");
}
return sbuf.toString();
|
public java.lang.Object | first()Gets the first element of the vector.
if (sipHeaderVector.size() == 0)
return null;
return this.sipHeaderVector.elementAt(0);
|
public java.util.Enumeration | getElements()Returns an enumeration of the imbedded vector.
return this.sipHeaderVector.elements();
|
public Header | getFirst()Gets the first element of the vector.
if (sipHeaderVector.size() == 0)
return null;
return (Header) this.sipHeaderVector.elementAt(0);
|
public java.util.Vector | getHeaders()Gets the header list.
return this.sipHeaderVector;
|
public java.util.Vector | getHeadersAsEncodedStrings()Returns a vector of encoded strings (one for each sipheader).
Vector retval = new Vector();
for (int i = 0; i < size(); i++) {
Header sipheader = (Header) elementAt(i);
retval.addElement(sipheader.encode());
}
return retval;
|
public NameValueList | getParameters()Gets the parameters of the header list.
return null;
|
public java.lang.Object | getValue()Gets the value of the header list.
Vector retval = new Vector();
for (int i = 0; i < size(); i++) {
Header sipheader = (Header) elementAt(i);
retval.addElement(sipheader);
}
return retval;
|
public boolean | isEmpty()Returns true if this is empty.
return sipHeaderVector.isEmpty();
|
public java.lang.Object | last()Gets the last element of the vector.
if (sipHeaderVector.size() == 0)
return null;
else return (Header) this.sipHeaderVector.elementAt
(sipHeaderVector.size() - 1);
|
public void | removeElement(java.lang.Object element)Removes the specified element.
sipHeaderVector.removeElement(element);
|
public void | removeFirst()Removes the first element of the list.
if (sipHeaderVector.size() == 0)
return;
else
sipHeaderVector.removeElementAt(0);
|
public void | removeLast()Removes the lastentry in the header list.
if (sipHeaderVector.size() != 0) {
sipHeaderVector.removeElementAt(sipHeaderVector.size() -1);
}
|
public int | size()Returns the list size.
return sipHeaderVector.size();
|