Package org.apache.http.message
Class BufferedHeader
java.lang.Object
org.apache.http.message.BufferedHeader
- All Implemented Interfaces:
Cloneable,FormattedHeader,Header
public class BufferedHeader extends Object implements FormattedHeader, Cloneable
This class represents a raw HTTP header whose content is parsed 'on demand'
only when the header value needs to be consumed.
- Version:
- $Revision: 604625 $ $Date: 2007-12-16 06:11:11 -0800 (Sun, 16 Dec 2007) $
- Author:
- Oleg Kalnichevski
-
Constructor Summary
Constructors Constructor Description BufferedHeader(CharArrayBuffer buffer)Creates a new header from a buffer. -
Method Summary
Modifier and Type Method Description Objectclone()Creates and returns a copy of thisObject.CharArrayBuffergetBuffer()Obtains the buffer with the formatted header.HeaderElement[]getElements()StringgetName()StringgetValue()intgetValuePos()Obtains the start of the header value in thebuffer.StringtoString()Returns a string containing a concise, human-readable description of this object.
-
Constructor Details
-
BufferedHeader
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- Throws:
ParseException- in case of a parse error
-
-
Method Details
-
getName
-
getValue
-
getElements
- Specified by:
getElementsin interfaceHeader- Throws:
ParseException
-
getValuePos
public int getValuePos()Description copied from interface:FormattedHeaderObtains the start of the header value in thebuffer. By accessing the value in the buffer, creation of a temporary string can be avoided.- Specified by:
getValuePosin interfaceFormattedHeader- Returns:
- index of the first character of the header value
in the buffer returned by
getBuffer.
-
getBuffer
Description copied from interface:FormattedHeaderObtains the buffer with the formatted header. The returned buffer MUST NOT be modified.- Specified by:
getBufferin interfaceFormattedHeader- Returns:
- the formatted header, in a buffer that must not be modified
-
toString
Description copied from class:ObjectReturns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toStringmethod if you intend implementing your owntoStringmethod. -
clone
Description copied from class:ObjectCreates and returns a copy of thisObject. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should callsuper.clone()to create the new instance and then create deep copies of the nested, mutable objects.- Overrides:
clonein classObject- Returns:
- a copy of this object.
- Throws:
CloneNotSupportedException- if this object's class does not implement theCloneableinterface.
-