Package com.azure.android.core.http
Class HttpHeaders
- java.lang.Object
 - 
- com.azure.android.core.http.HttpHeaders
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<HttpHeader>
public class HttpHeaders extends java.lang.Object implements java.lang.Iterable<HttpHeader>
A collection of headers on an HTTP request or response. 
- 
- 
Constructor Summary
Constructors Constructor Description HttpHeaders()Create an empty HttpHeaders instance.HttpHeaders(java.lang.Iterable<HttpHeader> headers)Create a HttpHeaders instance with the provided initial headers.HttpHeaders(java.util.Map<java.lang.String,java.lang.String> headers)Create a HttpHeaders instance with the provided initial headers. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpHeaderget(java.lang.String name)Gets theheaderfor the provided header name.intgetSize()Gets the number of headers in the collection.java.lang.StringgetValue(java.lang.String name)Get the value for the provided header name.java.lang.String[]getValues(java.lang.String name)Get the values for the provided header name.java.util.Iterator<HttpHeader>iterator()HttpHeadersput(java.lang.String name, java.lang.String value)Sets aheaderwith the given name and value.HttpHeaderremove(java.lang.String name)Removes theheaderwith the provided header name.java.util.Map<java.lang.String,java.lang.String>toMap()Gets aMaprepresentation of the HttpHeaders collection.java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
HttpHeaders
public HttpHeaders()
Create an empty HttpHeaders instance. 
- 
HttpHeaders
public HttpHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Create a HttpHeaders instance with the provided initial headers.- Parameters:
 headers- the map of initial headers
 
- 
HttpHeaders
public HttpHeaders(java.lang.Iterable<HttpHeader> headers)
Create a HttpHeaders instance with the provided initial headers.- Parameters:
 headers- the collection of initial headers
 
 - 
 
- 
Method Detail
- 
getSize
public int getSize()
Gets the number of headers in the collection.- Returns:
 - the number of headers in this collection.
 
 
- 
put
public HttpHeaders put(java.lang.String name, java.lang.String value)
Sets aheaderwith the given name and value.If header with same name already exists then the value will be overwritten.
- Parameters:
 name- the namevalue- the value- Returns:
 - The updated HttpHeaders object
 
 
- 
get
public HttpHeader get(java.lang.String name)
Gets theheaderfor the provided header name.Nullis returned if the header isn't found.- Parameters:
 name- the name of the header to find.- Returns:
 - the header if found, null otherwise.
 
 
- 
remove
public HttpHeader remove(java.lang.String name)
Removes theheaderwith the provided header name.Nullis returned if the header isn't found.- Parameters:
 name- the name of the header to remove.- Returns:
 - the header if removed, null otherwise.
 
 
- 
getValue
public java.lang.String getValue(java.lang.String name)
Get the value for the provided header name.Nullis returned if the header name isn't found.- Parameters:
 name- the name of the header whose value is being retrieved.- Returns:
 - the value of the header, or null if the header isn't found
 
 
- 
getValues
public java.lang.String[] getValues(java.lang.String name)
Get the values for the provided header name.Nullis returned if the header name isn't found.This returns
getValuesplit bycomma.- Parameters:
 name- the name of the header whose value is being retrieved.- Returns:
 - the values of the header, or null if the header isn't found
 
 
- 
toMap
public java.util.Map<java.lang.String,java.lang.String> toMap()
Gets aMaprepresentation of the HttpHeaders collection.- Returns:
 - the headers as map
 
 
- 
iterator
public java.util.Iterator<HttpHeader> iterator()
- Specified by:
 iteratorin interfacejava.lang.Iterable<HttpHeader>
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -