FileDocCategorySizeDatePackage
HeaderValueFormatter.javaAPI DocAndroid 1.5 API5593Wed May 06 22:41:10 BST 2009org.apache.http.message

HeaderValueFormatter

public interface HeaderValueFormatter
Interface for formatting elements of a header value. This is the complement to {@link HeaderValueParser}. Instances of this interface are expected to be stateless and thread-safe.

All formatting methods accept an optional buffer argument. If a buffer is passed in, the formatted element will be appended and the modified buffer is returned. If no buffer is passed in, a new buffer will be created and filled with the formatted element. In both cases, the caller is allowed to modify the returned buffer.

version
$Revision: 571954 $
since
4.0

Fields Summary
Constructors Summary
Methods Summary
public org.apache.http.util.CharArrayBufferformatElements(org.apache.http.util.CharArrayBuffer buffer, org.apache.http.HeaderElement[] elems, boolean quote)
Formats an array of header elements.

param
buffer the buffer to append to, or null to create a new buffer
param
elems the header elements to format
param
quote true to always format with quoted values, false to use quotes only when necessary
return
a buffer with the formatted header elements. If the buffer argument was not null, that buffer will be used and returned.

public org.apache.http.util.CharArrayBufferformatHeaderElement(org.apache.http.util.CharArrayBuffer buffer, org.apache.http.HeaderElement elem, boolean quote)
Formats one header element.

param
buffer the buffer to append to, or null to create a new buffer
param
elem the header element to format
param
quote true to always format with quoted values, false to use quotes only when necessary
return
a buffer with the formatted header element. If the buffer argument was not null, that buffer will be used and returned.

public org.apache.http.util.CharArrayBufferformatNameValuePair(org.apache.http.util.CharArrayBuffer buffer, org.apache.http.NameValuePair nvp, boolean quote)
Formats one name-value pair, where the value is optional.

param
buffer the buffer to append to, or null to create a new buffer
param
nvp the name-value pair to format
param
quote true to always format with a quoted value, false to use quotes only when necessary
return
a buffer with the formatted name-value pair. If the buffer argument was not null, that buffer will be used and returned.

public org.apache.http.util.CharArrayBufferformatParameters(org.apache.http.util.CharArrayBuffer buffer, org.apache.http.NameValuePair[] nvps, boolean quote)
Formats the parameters of a header element. That's a list of name-value pairs, to be separated by semicolons. This method will not generate a leading semicolon.

param
buffer the buffer to append to, or null to create a new buffer
param
nvps the parameters (name-value pairs) to format
param
quote true to always format with quoted values, false to use quotes only when necessary
return
a buffer with the formatted parameters. If the buffer argument was not null, that buffer will be used and returned.