• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
HeaderGroup Class Reference

A class for combining a set of headers. More...

Inherits Cloneable.

Description

This class allows for multiple headers with the same name and keeps track of the order in which headers were added.

Author
Michael Becke
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

 HeaderGroup ()
 Constructor for HeaderGroup.
 
void clear ()
 Removes any contained headers.
 
void addHeader (Header header)
 Adds the given header to the group. More...
 
void removeHeader (Header header)
 Removes the given header. More...
 
void updateHeader (Header header)
 Replaces the first occurence of the header with the same name. More...
 
void setHeaders (Header[] headers)
 Sets all of the headers contained within this group overriding any existing headers. More...
 
Header getCondensedHeader (String name)
 Gets a header representing all of the header values with the given name. More...
 
Header[] getHeaders (String name)
 Gets all of the headers with the given name. More...
 
Header getFirstHeader (String name)
 Gets the first header with the given name. More...
 
Header getLastHeader (String name)
 Gets the last header with the given name. More...
 
Header[] getAllHeaders ()
 Gets all of the headers contained within this group. More...
 
boolean containsHeader (String name)
 Tests if headers with the given name are contained within this group. More...
 
HeaderIterator iterator ()
 Returns an iterator over this group of headers. More...
 
HeaderIterator iterator (final String name)
 Returns an iterator over the headers with a given name in this group. More...
 
HeaderGroup copy ()
 Returns a copy of this object. More...
 

Member Function Documentation

◆ addHeader()

void addHeader ( Header  header)

The order in which this header was added is preserved.

Parameters
headerthe header to add

◆ removeHeader()

void removeHeader ( Header  header)
Parameters
headerthe header to remove

◆ updateHeader()

void updateHeader ( Header  header)

If no header with the same name is found the given header is added to the end of the list.

Parameters
headerthe new header that should replace the first header with the same name if present in the list.

◆ setHeaders()

void setHeaders ( Header[]  headers)

The headers are added in the order in which they appear in the array.

Parameters
headersthe headers to set

◆ getCondensedHeader()

Header getCondensedHeader ( String  name)

If more that one header with the given name exists the values will be combined with a "," as per RFC 2616.

Header name comparison is case insensitive.

Parameters
namethe name of the header(s) to get
Returns
a header with a condensed value or null if no headers by the given name are present

◆ getHeaders()

Header [] getHeaders ( String  name)

The returned array maintains the relative order in which the headers were added.

Header name comparison is case insensitive.

Parameters
namethe name of the header(s) to get
Returns
an array of length >= 0

◆ getFirstHeader()

Header getFirstHeader ( String  name)

Header name comparison is case insensitive.

Parameters
namethe name of the header to get
Returns
the first header or null

◆ getLastHeader()

Header getLastHeader ( String  name)

Header name comparison is case insensitive.

Parameters
namethe name of the header to get
Returns
the last header or null

◆ getAllHeaders()

Header [] getAllHeaders ( )
Returns
an array of length >= 0

◆ containsHeader()

boolean containsHeader ( String  name)

Header name comparison is case insensitive.

Parameters
namethe header name to test for
Returns
true if at least one header with the name is contained, false otherwise

◆ iterator() [1/2]

HeaderIterator iterator ( )
Returns
iterator over this group of headers.
Since
4.0

◆ iterator() [2/2]

HeaderIterator iterator ( final String  name)
Parameters
namethe name of the headers over which to iterate, or null for all headers
Returns
iterator over some headers in this group.
Since
4.0

◆ copy()

HeaderGroup copy ( )
Returns
copy of this object