Class StringRanges
The returned ranges are sorted such that the most acceptable value is available at ordinal position
RFC2616 Specification
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings (section 3.5) that are acceptable in the response.Accept-Encoding = "Accept-Encoding" ":" 1#( codings [ ";" "q" "=" qvalue ] ) codings = ( content-coding | "*" )
Examples of its use are:
Accept-Encoding: compress, gzip Accept-Encoding: Accept-Encoding: * Accept-Encoding: compress;q=0.5, gzip;q=1.0 Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final StringRanges
Represents an empty string ranges object. -
Constructor Summary
ConstructorDescriptionStringRanges
(String value) Constructor.StringRanges
(HeaderElement... e) Constructor.StringRanges
(StringRange... value) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionforEachRange
(Consumer<StringRange> action) Performs an action on the string ranges that make up this object.getRange
(int index) Returns theMediaRange
at the specified index.int
Given a list of media types, returns the best match for this string range header.static StringRanges
Returns a parsed string range header value.static StringRanges
of
(StringRange... value) Returns a parsed string range header value.toList()
Returns the string ranges that make up this object.toString()
-
Field Details
-
EMPTY
Represents an empty string ranges object.
-
-
Constructor Details
-
StringRanges
Constructor.- Parameters:
value
- The string range header value.
-
StringRanges
Constructor.- Parameters:
value
- The string range header value.
-
StringRanges
Constructor.- Parameters:
e
- The parsed string range header value.
-
-
Method Details
-
of
Returns a parsed string range header value.- Parameters:
value
- The raw header value.- Returns:
- A parsed header value.
-
of
Returns a parsed string range header value.- Parameters:
value
- The raw header value.- Returns:
- A parsed header value.
-
match
Given a list of media types, returns the best match for this string range header.Note that fuzzy matching is allowed on the media types where the string range header may contain additional subtype parts.
For example, given identical q-values and an string range value of"text/json+activity" , the media type"text/json" will match if"text/json+activity" or"text/activity+json" isn't found.
The purpose for this is to allow serializers to match when artifacts such asid properties are present in the header.- Parameters:
names
- The names to match against.- Returns:
- The index into the array of the best match, or
-1 if no suitable matches could be found.
-
getRange
Returns theMediaRange
at the specified index.- Parameters:
index
- The index position of the media range.- Returns:
- The
MediaRange
at the specified index ornull if the index is out of range.
-
toList
Returns the string ranges that make up this object.- Returns:
- The string ranges that make up this object.
-
forEachRange
Performs an action on the string ranges that make up this object.- Parameters:
action
- The action to perform.- Returns:
- This object.
-
toString
-