Package org.apache.hc.core5.http.message
Class BufferedHeader
java.lang.Object
org.apache.hc.core5.http.message.BufferedHeader
- All Implemented Interfaces:
Serializable
,FormattedHeader
,Header
,NameValuePair
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CharArrayBuffer
The buffer containing the entire header line.private final String
Header name.private static final long
private final int
The beginning of the header value in the buffer -
Constructor Summary
ConstructorsConstructorDescriptionBufferedHeader
(CharArrayBuffer buffer) Creates a new header from a buffer.BufferedHeader
(CharArrayBuffer buffer, boolean strict) -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedHeader
create
(CharArrayBuffer buffer) Obtains the buffer with the formatted header.getName()
Gets the name of this pair.getValue()
Gets the value of this pair.int
Obtains the start of the header value in thebuffer
.boolean
Returnstrue
if the header should be considered sensitive.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
Header name. -
buffer
The buffer containing the entire header line. -
valuePos
private final int valuePosThe beginning of the header value in the buffer
-
-
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
-
BufferedHeader
BufferedHeader(CharArrayBuffer buffer, boolean strict) throws ParseException - Throws:
ParseException
-
-
Method Details
-
create
- Since:
- 5.0
-
getName
Description copied from interface:NameValuePair
Gets the name of this pair.- Specified by:
getName
in interfaceNameValuePair
- Returns:
- the name of this pair, never
null
.
-
getValue
Description copied from interface:NameValuePair
Gets the value of this pair.- Specified by:
getValue
in interfaceNameValuePair
- Returns:
- the value of this pair, may be
null
.
-
isSensitive
public boolean isSensitive()Description copied from interface:Header
Returnstrue
if the header should be considered sensitive.Some encoding schemes such as HPACK impose restrictions on encoded representation of sensitive headers.
- Specified by:
isSensitive
in interfaceHeader
- Returns:
true
if the header should be considered sensitive.
-
getValuePos
public int getValuePos()Description copied from interface:FormattedHeader
Obtains 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:
getValuePos
in interfaceFormattedHeader
- Returns:
- index of the first character of the header value
in the buffer returned by
getBuffer
.
-
getBuffer
Description copied from interface:FormattedHeader
Obtains the buffer with the formatted header. The returned buffer MUST NOT be modified.- Specified by:
getBuffer
in interfaceFormattedHeader
- Returns:
- the formatted header, in a buffer that must not be modified
-
toString
-