public class

BufferedHeader

extends Object
implements Cloneable FormattedHeader
java.lang.Object
   ↳ org.apache.http.message.BufferedHeader

Class Overview

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

Summary

Public Constructors
BufferedHeader(CharArrayBuffer buffer)
Creates a new header from a buffer.
Public Methods
Object clone()
Creates and returns a copy of this Object.
CharArrayBuffer getBuffer()
Obtains the buffer with the formatted header.
HeaderElement[] getElements()
String getName()
String getValue()
int getValuePos()
Obtains the start of the header value in the buffer.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.FormattedHeader
From interface org.apache.http.Header

Public Constructors

public BufferedHeader (CharArrayBuffer buffer)

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

Public Methods

public Object clone ()

Creates and returns a copy of this Object. 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 call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
  • a copy of this object.

public CharArrayBuffer getBuffer ()

Obtains the buffer with the formatted header. The returned buffer MUST NOT be modified.

Returns
  • the formatted header, in a buffer that must not be modified

public HeaderElement[] getElements ()

public String getName ()

public String getValue ()

public int getValuePos ()

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.

Returns
  • index of the first character of the header value in the buffer returned by getBuffer.

public String toString ()

Returns 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 simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a printable representation of this object.