org.eclipse.osgi.framework.util
Class Headers

java.lang.Object
  extended by java.util.Dictionary
      extended by org.eclipse.osgi.framework.util.Headers
All Implemented Interfaces:
java.util.Map

public class Headers
extends java.util.Dictionary
implements java.util.Map

Headers classes. This class implements a Dictionary that has the following behaviour:

Since:
3.1

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry
 
Constructor Summary
Headers(java.util.Dictionary values)
          Create a Headers dictionary from a Dictionary.
Headers(int initialCapacity)
          Create an empty Headers dictionary.
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object var0)
           
 java.util.Enumeration elements()
          Values.
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
          Support case-insensitivity for keys.
 boolean isEmpty()
          Tests if this dictionary maps no keys to value.
 java.util.Enumeration keys()
          Case-preserved keys.
 java.util.Set keySet()
           
static Headers parseManifest(java.io.InputStream in)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Always throws UnsupportedOperationException.
 void putAll(java.util.Map var0)
           
 java.lang.Object remove(java.lang.Object key)
          Always throws UnsupportedOperationException.
 java.lang.Object set(java.lang.Object key, java.lang.Object value)
          Set a header value.
 java.lang.Object set(java.lang.Object key, java.lang.Object value, boolean replace)
          Set a header value or optionally replace it if it already exists.
 void setReadOnly()
           
 int size()
          Returns the number of entries (distinct keys) in this dictionary.
 java.lang.String toString()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Headers

public Headers(int initialCapacity)
Create an empty Headers dictionary.

Parameters:
initialCapacity - The initial capacity of this Headers object.

Headers

public Headers(java.util.Dictionary values)
Create a Headers dictionary from a Dictionary.

Parameters:
values - The initial dictionary for this Headers object.
Throws:
java.lang.IllegalArgumentException - If a case-variant of the key is in the dictionary parameter.
Method Detail

keys

public java.util.Enumeration keys()
Case-preserved keys.

Specified by:
keys in class java.util.Dictionary

elements

public java.util.Enumeration elements()
Values.

Specified by:
elements in class java.util.Dictionary

get

public java.lang.Object get(java.lang.Object key)
Support case-insensitivity for keys.

Specified by:
get in interface java.util.Map
Specified by:
get in class java.util.Dictionary
Parameters:
key - name.

set

public java.lang.Object set(java.lang.Object key,
                            java.lang.Object value,
                            boolean replace)
Set a header value or optionally replace it if it already exists.

Parameters:
key - Key name.
value - Value of the key or null to remove key.
replace - A value of true will allow a previous value of the key to be replaced. A value of false will cause an IllegalArgumentException to be thrown if a previous value of the key exists.
Returns:
the previous value to which the key was mapped, or null if the key did not have a previous mapping.
Throws:
java.lang.IllegalArgumentException - If a case-variant of the key is already present.
Since:
3.2

set

public java.lang.Object set(java.lang.Object key,
                            java.lang.Object value)
Set a header value.

Parameters:
key - Key name.
value - Value of the key or null to remove key.
Returns:
the previous value to which the key was mapped, or null if the key did not have a previous mapping.
Throws:
java.lang.IllegalArgumentException - If a case-variant of the key is already present.

setReadOnly

public void setReadOnly()

size

public int size()
Returns the number of entries (distinct keys) in this dictionary.

Specified by:
size in interface java.util.Map
Specified by:
size in class java.util.Dictionary
Returns:
the number of keys in this dictionary.

isEmpty

public boolean isEmpty()
Tests if this dictionary maps no keys to value. The general contract for the isEmpty method is that the result is true if and only if this dictionary contains no entries.

Specified by:
isEmpty in interface java.util.Map
Specified by:
isEmpty in class java.util.Dictionary
Returns:
true if this dictionary maps no keys to values; false otherwise.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Always throws UnsupportedOperationException.

Specified by:
put in interface java.util.Map
Specified by:
put in class java.util.Dictionary
Parameters:
key - header name.
value - header value.
Throws:
java.lang.UnsupportedOperationException

remove

public java.lang.Object remove(java.lang.Object key)
Always throws UnsupportedOperationException.

Specified by:
remove in interface java.util.Map
Specified by:
remove in class java.util.Dictionary
Parameters:
key - header name.
Throws:
java.lang.UnsupportedOperationException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

parseManifest

public static Headers parseManifest(java.io.InputStream in)
                             throws BundleException
Throws:
BundleException

clear

public void clear()
Specified by:
clear in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object var0)
Specified by:
containsValue in interface java.util.Map

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

putAll

public void putAll(java.util.Map var0)
Specified by:
putAll in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map