Home » openjdk-7 » sun » net » www » [javadoc | source]
sun.net.www
public class: MessageHeader [javadoc | source]
java.lang.Object
   sun.net.www.MessageHeader
An RFC 844 or MIME message header. Includes methods for parsing headers from incoming streams, fetching values, setting values, and printing headers. Key values of null are legal: they indicate lines in the header that don't have a valid key, but do have a value (this isn't legal according to the standard, but lines like this are everywhere).
Nested Class Summary:
class  MessageHeader.HeaderIterator   
Constructor:
 public MessageHeader() 
 public MessageHeader(InputStream is) throws IOException 
Method from sun.net.www.MessageHeader Summary:
add,   canonicalID,   filterAndAddHeaders,   findNextValue,   findValue,   getHeaders,   getHeaders,   getKey,   getKey,   getValue,   mergeHeader,   multiValueIterator,   parseHeader,   prepend,   print,   remove,   reset,   set,   set,   setIfNotSet,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.net.www.MessageHeader Detail:
 public synchronized  void add(String k,
    String v) 
    Adds a key value pair to the end of the header. Duplicates are allowed
 public static String canonicalID(String id) 
    Convert a message-id string to canonical form (strips off leading and trailing <>s)
 public synchronized Map<String> filterAndAddHeaders(String[] excludeList,
    Map<String> include) 
 public synchronized String findNextValue(String k,
    String v) 
    Deprecated: Use multiValueIterator() instead. Find the next value that corresponds to this key. It finds the first value that follows v. To iterate over all the values of a key use:
             for(String v=h.findValue(k); v!=null; v=h.findNextValue(k, v)) {
                 ...
             }
     
 public synchronized String findValue(String k) 
    Find the value that corresponds to this key. It finds only the first occurrence of the key.
 public synchronized Map<String> getHeaders() 
 public synchronized Map<String> getHeaders(String[] excludeList) 
 public synchronized int getKey(String k) 
 public synchronized String getKey(int n) 
 public synchronized String getValue(int n) 
 public  void mergeHeader(InputStream is) throws IOException 
    Parse and merge a MIME header from an input stream.
 public Iterator<String> multiValueIterator(String k) 
    return an Iterator that returns all values of a particular key in sequence
 public  void parseHeader(InputStream is) throws IOException 
    Parse a MIME header from an input stream.
 public synchronized  void prepend(String k,
    String v) 
    Prepends a key value pair to the beginning of the header. Duplicates are allowed
 public synchronized  void print(PrintStream p) 
    Prints the key-value pairs represented by this header. Also prints the RFC required blank line at the end. Omits pairs with a null key.
 public synchronized  void remove(String k) 
    Remove the key from the header. If there are multiple values under the same key, they are all removed. Nothing is done if the key doesn't exist. After a remove, the other pairs' order are not changed.
 public synchronized  void reset() 
    Reset a message header (all key/values removed)
 public synchronized  void set(String k,
    String v) 
    Sets the value of a key. If the key already exists in the header, it's value will be changed. Otherwise a new key/value pair will be added to the end of the header.
 public synchronized  void set(int i,
    String k,
    String v) 
    Overwrite the previous key/val pair at location 'i' with the new k/v. If the index didn't exist before the key/val is simply tacked onto the end.
 public synchronized  void setIfNotSet(String k,
    String v) 
    Set's the value of a key only if there is no key with that value already.
 public synchronized String toString()