org.sblim.cimclient.internal.http

Class HttpHeader

public class HttpHeader extends Object

Class HttpHeader represents a http header block
Nested Class Summary
static classHttpHeader.HeaderEntry
Class HeaderEntry represents a single header field
Constructor Summary
HttpHeader()
Ctor.
HttpHeader(InputStream pReader)
Ctor.
Method Summary
voidaddField(String pName, String pValue)
Adds a header field
voidclear()
Clears all header fields
static Stringencode(byte[] pData)
Encodes raw data
static Stringencode(byte[] pData, String pEnc)
Encodes raw data for a given character set
static Stringencode(String pData, String pSourceEnc, String pTargetEnc)
Encodes a given string for a given character set
voidexamineTrailer()
Throws a TrailerException if it contains recognized CIM errors in http trailer entries.
StringgetField(String pName)
Returns a field from the header
Iterator<Entry<HttpHeader.HeaderEntry,String>>iterator()
Return an iterator over the header fields
static HttpHeaderparse(String pLine)
Parses a line from a header block
voidremoveField(String pName)
Removes a field from the header
voidwrite(ASCIIPrintStream pWriter)
Writes a header block to a stream

Constructor Detail

HttpHeader

public HttpHeader()
Ctor.

HttpHeader

public HttpHeader(InputStream pReader)
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

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)
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)
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 a TrailerException if it contains recognized CIM errors in http trailer entries.

Throws: TrailerException

getField

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

Parameters: pName The name of the field

Returns: The value

iterator

public Iterator<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

removeField

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

Parameters: pName The name of the field

write

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

Parameters: pWriter The stream

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