A class for combining a set of headers. More...
Inherits Cloneable.
This class allows for multiple headers with the same name and keeps track of the order in which headers were added.
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... | |
void addHeader | ( | Header | header | ) |
The order in which this header was added is preserved.
header | the header to add |
void removeHeader | ( | Header | header | ) |
header | the header to remove |
void updateHeader | ( | Header | header | ) |
If no header with the same name is found the given header is added to the end of the list.
header | the new header that should replace the first header with the same name if present in the list. |
void setHeaders | ( | Header[] | headers | ) |
The headers are added in the order in which they appear in the array.
headers | the headers to set |
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.
name | the name of the header(s) to get |
null
if no headers by the given name are present Header [] getHeaders | ( | String | name | ) |
The returned array maintains the relative order in which the headers were added.
Header name comparison is case insensitive.
name | the name of the header(s) to get |
Header getFirstHeader | ( | String | name | ) |
Header name comparison is case insensitive.
name | the name of the header to get |
null
Header getLastHeader | ( | String | name | ) |
Header name comparison is case insensitive.
name | the name of the header to get |
null
Header [] getAllHeaders | ( | ) |
boolean containsHeader | ( | String | name | ) |
Header name comparison is case insensitive.
name | the header name to test for |
true
if at least one header with the name is contained, false
otherwise HeaderIterator iterator | ( | ) |
HeaderIterator iterator | ( | final String | name | ) |
name | the name of the headers over which to iterate, or null for all headers |
HeaderGroup copy | ( | ) |