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 Details

    • BufferedHeader

      public BufferedHeader​(CharArrayBuffer buffer) 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
      Throws:
      ParseException - in case of a parse error
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface Header
    • getValue

      public String getValue()
      Specified by:
      getValue in interface Header
    • 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 String toString()
      Description copied from class: Object
      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 is equivalent to the following expression:
         getClass().getName() + '@' + Integer.toHexString(hashCode())

      See Writing a useful toString method if you intend implementing your own toString method.

      Overrides:
      toString in class Object
      Returns:
      a printable representation of this object.
    • clone

      public Object clone() throws CloneNotSupportedException
      Description copied from class: Object
      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.
      Overrides:
      clone in class Object
      Returns:
      a copy of this object.
      Throws:
      CloneNotSupportedException - if this object's class does not implement the Cloneable interface.