org.apache.http.message
Class BufferedHeader

java.lang.Object
  extended by org.apache.http.message.BufferedHeader
All Implemented Interfaces:
FormattedHeader, Header

public class BufferedHeader
extends java.lang.Object
implements FormattedHeader

This class represents a raw HTTP header whose content is parsed 'on demand' only when the header value needs to be consumed.

Version:
$Revision: 569781 $ $Date: 2007-08-26 11:05:06 +0200 (Sun, 26 Aug 2007) $
Author:
Oleg Kalnichevski

Constructor Summary
BufferedHeader(CharArrayBuffer buffer)
           
BufferedHeader(CharArrayBuffer buffer, HeaderValueParser parser)
          Creates a new header from a buffer.
 
Method Summary
 CharArrayBuffer getBuffer()
          Obtains the buffer with the formatted header.
 HeaderElement[] getElements()
           
 java.lang.String getName()
           
 HeaderValueParser getParser()
           
 java.lang.String getValue()
           
 int getValuePos()
          Obtains the start of the header value in the buffer.
 void setParser(HeaderValueParser parser)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BufferedHeader

public BufferedHeader(CharArrayBuffer buffer,
                      HeaderValueParser parser)
               throws ParseException
Creates a new header from a buffer. The name of the header will be parsed immediately, the value only if it is accessed.

Parameters:
buffer - the buffer containing the header to represent
parser - the header value parser, or null
Throws:
ParseException - in case of a parse error

BufferedHeader

public BufferedHeader(CharArrayBuffer buffer)
               throws ParseException
Throws:
ParseException
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Header

getValue

public java.lang.String getValue()
Specified by:
getValue in interface Header

getParser

public HeaderValueParser getParser()

setParser

public void setParser(HeaderValueParser parser)

getElements

public HeaderElement[] getElements()
                            throws ParseException
Specified by:
getElements in interface Header
Throws:
ParseException

getValuePos

public int getValuePos()
Description copied from interface: FormattedHeader
Obtains the start of the header value in the buffer. By accessing the value in the buffer, creation of a temporary string can be avoided.

Specified by:
getValuePos in interface FormattedHeader
Returns:
index of the first character of the header value in the buffer returned by getBuffer.

getBuffer

public CharArrayBuffer getBuffer()
Description copied from interface: FormattedHeader
Obtains the buffer with the formatted header. The returned buffer MUST NOT be modified.

Specified by:
getBuffer in interface FormattedHeader
Returns:
the formatted header, in a buffer that must not be modified

toString

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


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.