Package org.apache.juneau.http.header
Class ContentRange.Builder
java.lang.Object
org.apache.juneau.http.header.ContentRange.Builder
- Enclosing class:
- ContentRange
Fluent builder for assembling an HTTP Content-Range header value.
Composes the three fields defined by
RFC 7233 §4.2 — the range unit
(default
Example:
String
See Also:
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the renderedContent-Range header value.length(long value) Sets thecomplete-length (the total size of the representation).range(long startValue, long endValue) Sets the resolvedfirst-last byte range.toHeader()Builds aContentRangeheader bean directly from this builder.toString()Sets the range unit (defaultbytes ).Marks the complete length as unknown, rendering it as* .Marks the range portion as unsatisfied, rendering it as* (used with a known complete length).
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
unit
Sets the range unit (defaultbytes ).- Parameters:
value- The range unit. Must not benull or blank.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueisnull or blank.
-
range
Sets the resolvedfirst-last byte range.Clears any previously-set
unsatisfiedmarker.- Parameters:
startValue- The first byte position (inclusive). Must be non-negative.endValue- The last byte position (inclusive). Must be greater than or equal tostartValue.- Returns:
- This object.
- Throws:
IllegalArgumentException- If the positions are negative or out of order.
-
unsatisfiedRange
Marks the range portion as unsatisfied, rendering it as* (used with a known complete length).- Returns:
- This object.
-
length
Sets thecomplete-length (the total size of the representation).Clears any previously-set
unknown-lengthmarker.- Parameters:
value- The complete length in units. Must be non-negative.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueis negative.
-
unknownLength
Marks the complete length as unknown, rendering it as* .- Returns:
- This object.
-
build
Builds the renderedContent-Range header value.- Returns:
- The header value. Never
null .
-
toHeader
Builds aContentRangeheader bean directly from this builder.- Returns:
- A
ContentRangecarryingbuild(). Nevernull .
-
toString
-