Package org.apache.http.message
Class BufferedHeader
- java.lang.Object
-
- org.apache.http.message.BufferedHeader
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,FormattedHeader,Header
public class BufferedHeader extends java.lang.Object implements FormattedHeader, java.lang.Cloneable, java.io.Serializable
This class represents a raw HTTP header whose content is parsed 'on demand' only when the header value needs to be consumed.- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BufferedHeader(CharArrayBuffer buffer)Creates a new header from a buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()CharArrayBuffergetBuffer()Obtains the buffer with the formatted header.HeaderElement[]getElements()Parses the value.java.lang.StringgetName()Get the name of the Header.java.lang.StringgetValue()Get the value of the Header.intgetValuePos()Obtains the start of the header value in thebuffer.java.lang.StringtoString()
-
-
-
Constructor Detail
-
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 Detail
-
getName
public java.lang.String getName()
Description copied from interface:HeaderGet the name of the Header.
-
getValue
public java.lang.String getValue()
Description copied from interface:HeaderGet the value of the Header.
-
getElements
public HeaderElement[] getElements() throws ParseException
Description copied from interface:HeaderParses the value.- Specified by:
getElementsin interfaceHeader- Returns:
- an array of
HeaderElemententries, may be empty, but is nevernull - Throws:
ParseException- in case of a parsing error
-
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
public CharArrayBuffer 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Throws:
java.lang.CloneNotSupportedException
-
-