gnu.java.net.protocol.http
Class Headers
- Cloneable, Map, Serializable
A collection of HTTP header names and associated values.
Retrieval of values is case insensitive. An iteration over the keys
returns the header names in the order they were received.
boolean | containsKey(Object key) - Returns true if this contains a mapping for the given key.
|
Set | entrySet() - Returns a set view of the mappings in this Map.
|
Object | get(Object key) - Returns the value mapped by the given key.
|
Date | getDateValue(String header) - Returns the value of the specified header as a date,
or
null if the header is not present or not a date.
|
int | getIntValue(String header) - Returns the value of the specified header as an integer,
or -1 if the header is not present or not an integer.
|
long | getLongValue(String header) - Returns the value of the specified header as a long, or -1 if the
header is not present or cannot be parsed as a long.
|
String | getValue(String header) - Returns the value of the specified header as a string.
|
Set | keySet() - Returns a set view of the keys in this Map.
|
void | parse(InputStream in) - Parse the specified input stream, adding headers to this collection.
|
Object | put(Object key, Object value) - Associates the given key to the given value (optional operation).
|
void | putAll(Map t) - Copies all entries of the given map to this one (optional operation).
|
Object | remove(Object key) - Removes the mapping for this key if present (optional operation).
|
clear , clone , containsKey , containsValue , entrySet , get , isEmpty , keySet , put , putAll , remove , size , values |
clear , clone , containsKey , containsValue , entrySet , equals , get , hashCode , isEmpty , keySet , put , putAll , remove , size , toString , values |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Headers
public Headers()
The basic constructor. Object is special, because it has no
superclass, so there is no call to super().
entrySet
public Set entrySet()
Returns a set view of the mappings in this Map. Each element in the
set is a Map.Entry. The set is backed by the map, so that changes in
one show up in the other. Modifications made while an iterator is
in progress cause undefined behavior. If the set supports removal,
these methods remove the underlying mapping from the map:
Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
.
Element addition, via add
or addAll
, is
not supported via this set.
- entrySet in interface Map
- entrySet in interface HashMap
- the set view of all mapping entries
get
public Object get(Object key)
Returns the value mapped by the given key. Returns null
if
there is no mapping. However, in Maps that accept null values, you
must rely on containsKey
to determine if a mapping exists.
- get in interface Map
- get in interface LinkedHashMap
- the value associated with the key, or null if key not in map
getDateValue
public Date getDateValue(String header)
Returns the value of the specified header as a date,
or null
if the header is not present or not a date.
getIntValue
public int getIntValue(String header)
Returns the value of the specified header as an integer,
or -1 if the header is not present or not an integer.
getLongValue
public long getLongValue(String header)
Returns the value of the specified header as a long, or -1 if the
header is not present or cannot be parsed as a long.
getValue
public String getValue(String header)
Returns the value of the specified header as a string.
keySet
public Set keySet()
Returns a set view of the keys in this Map. The set is backed by the
map, so that changes in one show up in the other. Modifications made
while an iterator is in progress cause undefined behavior. If the set
supports removal, these methods remove the underlying mapping from
the map: Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
.
Element addition, via add
or addAll
, is
not supported via this set.
- keySet in interface Map
- keySet in interface HashMap
put
public Object put(Object key,
Object value)
Associates the given key to the given value (optional operation). If the
map already contains the key, its value is replaced. Be aware that in
a map that permits null
values, a null return does not
always imply that the mapping was created.
- put in interface Map
- put in interface HashMap
key
- the key to mapvalue
- the value to be mapped
- the previous value of the key, or null if there was no mapping
putAll
public void putAll(Map t)
Copies all entries of the given map to this one (optional operation). If
the map already contains a key, its value is replaced.
- putAll in interface Map
- putAll in interface HashMap
remove
public Object remove(Object key)
Removes the mapping for this key if present (optional operation). If
the key is not present, this returns null. Note that maps which permit
null values may also return null if the key was removed.
- remove in interface Map
- remove in interface HashMap
- the value the key mapped to, or null if not present.
Headers.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.