to top
Android APIs
public class

BasicHeader

extends Object
implements Cloneable Header
java.lang.Object
   ↳ org.apache.http.message.BasicHeader

Class Overview

Represents an HTTP header field.

The HTTP header fields follow the same generic format as that given in Section 3.1 of RFC 822. Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive. The field value MAY be preceded by any amount of LWS, though a single SP is preferred.

     message-header = field-name ":" [ field-value ]
     field-name     = token
     field-value    = *( field-content | LWS )
     field-content  = <the OCTETs making up the field-value
                      and consisting of either *TEXT or combinations
                      of token, separators, and quoted-string>

Summary

Public Constructors
BasicHeader(String name, String value)
Constructor with name and value
Public Methods
Object clone()
Creates and returns a copy of this Object.
HeaderElement[] getElements()
Returns an array of HeaderElements constructed from my value.
String getName()
Returns the header name.
String getValue()
Returns the header value.
String toString()
Returns a String representation of the header.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.Header

Public Constructors

public BasicHeader (String name, String value)

Added in API level 1

Constructor with name and value

Parameters
name the header name
value the header value

Public Methods

public Object clone ()

Added in API level 1

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 HeaderElement[] getElements ()

Added in API level 1

Returns an array of HeaderElements constructed from my value.

Returns
  • an array of header elements
Throws
ParseException in case of a parse error

public String getName ()

Added in API level 1

Returns the header name.

Returns
  • String name The name

public String getValue ()

Added in API level 1

Returns the header value.

Returns
  • String value The current value.

public String toString ()

Added in API level 1

Returns a String representation of the header.

Returns
  • a string