org.sblim.cimclient.internal.http
Class HttpHeader

java.lang.Object
  extended by org.sblim.cimclient.internal.http.HttpHeader

public class HttpHeader
extends Object

Class HttpHeader represents a http header block


Nested Class Summary
static class HttpHeader.HeaderEntry
          Class HeaderEntry represents a single header field
 
Constructor Summary
HttpHeader()
          Ctor.
HttpHeader(InputStream pReader)
          Ctor.
 
Method Summary
 void addField(String pName, String pValue)
          Adds a header field
 void clear()
          Clears all header fields
static String encode(byte[] pData)
          Encodes raw data
static String encode(byte[] pData, String pEnc)
          Encodes raw data for a given character set
static String encode(String pData, String pSourceEnc, String pTargetEnc)
          Encodes a given string for a given character set
 void examineTrailer()
          Throws a TrailerException if it contains recognized CIM errors in http trailer entries.
 String getField(String pName)
          Returns a field from the header
 Iterator<Map.Entry<HttpHeader.HeaderEntry,String>> iterator()
          Return an iterator over the header fields
static HttpHeader parse(String pLine)
          Parses a line from a header block
 void removeField(String pName)
          Removes a field from the header
 String toString()
           
 void write(ASCIIPrintStream pWriter)
          Writes a header block to a stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpHeader

public HttpHeader()
Ctor.


HttpHeader

public HttpHeader(InputStream pReader)
           throws IOException
Ctor. Parses the header from an input stream

Parameters:
pReader - The input stream
Throws:
IOException
Method Detail

addField

public void addField(String pName,
                     String pValue)
Adds a header field

Parameters:
pName - The name of the header field
pValue - The value

clear

public void clear()
Clears all header fields


iterator

public Iterator<Map.Entry<HttpHeader.HeaderEntry,String>> iterator()
Return an iterator over the header fields

Returns:
The iterator

parse

public static HttpHeader parse(String pLine)
Parses a line from a header block

Parameters:
pLine - The line
Returns:
The http header

toString

public String toString()
Overrides:
toString in class Object

removeField

public void removeField(String pName)
Removes a field from the header

Parameters:
pName - The name of the field

getField

public String getField(String pName)
Returns a field from the header

Parameters:
pName - The name of the field
Returns:
The value

write

public void write(ASCIIPrintStream pWriter)
Writes a header block to a stream

Parameters:
pWriter - The stream

encode

public static String encode(byte[] pData)
Encodes raw data

Parameters:
pData - The raw data
Returns:
The encoded data

encode

public static String encode(byte[] pData,
                            String pEnc)
                     throws UnsupportedEncodingException
Encodes raw data for a given character set

Parameters:
pData - The raw data
pEnc - The character set
Returns:
The encoded data
Throws:
UnsupportedEncodingException

encode

public static String encode(String pData,
                            String pSourceEnc,
                            String pTargetEnc)
                     throws UnsupportedEncodingException
Encodes a given string for a given character set

Parameters:
pData - The source string
pSourceEnc - The source character set
pTargetEnc - The target character set
Returns:
The encoded string
Throws:
UnsupportedEncodingException

examineTrailer

public void examineTrailer()
                    throws TrailerException
Throws a TrailerException if it contains recognized CIM errors in http trailer entries.

Throws:
TrailerException


Copyright © 2005, 2009 IBM Corporation. All Rights Reserved.