Package com.azure.core.util
Class Header
java.lang.Object
com.azure.core.util.Header
- Direct Known Subclasses:
HttpHeader
Represents a single header to be set on a request.
If multiple header values are added to a request with the same name (case-insensitive), then the values will be
appended at the end of the same Header with commas separating them.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a Header instance using the provided name and value.Create a Header instance using the provided name and values.Create a Header instance using the provided name and values. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new value to the end of the Header.getName()Gets the header name.getValue()Gets the combined, comma-separated value of thisHeader, taking into account all values provided.String[]Gets the comma separated value as an array.Returns all values associated with this header, represented as an unmodifiable list of strings.toString()Gets the String representation of the header.
-
Constructor Details
-
Header
Create a Header instance using the provided name and value.- Parameters:
name- the name of the header.value- the value of the header.- Throws:
NullPointerException- ifnameis null.
-
Header
Create a Header instance using the provided name and values.- Parameters:
name- the name of the header.values- the values of the header.- Throws:
NullPointerException- ifnameis null.
-
Header
Create a Header instance using the provided name and values.- Parameters:
name- the name of the header.values- the values of the header.- Throws:
NullPointerException- ifnameis null.
-
-
Method Details
-
getName
Gets the header name.- Returns:
- the name of this
Header
-
getValue
Gets the combined, comma-separated value of thisHeader, taking into account all values provided.- Returns:
- the value of this Header
-
getValues
Gets the comma separated value as an array. Changes made to this array will not be reflected in the headers.- Returns:
- the values of this
Headerthat are separated by a comma
-
getValuesList
Returns all values associated with this header, represented as an unmodifiable list of strings.- Returns:
- An unmodifiable list containing all values associated with this header.
-
addValue
Add a new value to the end of the Header.- Parameters:
value- the value to add
-
toString
Gets the String representation of the header.
-