public abstract class HttpRange extends Object
"Range" header.HttpHeaders.setRange(List),
HttpHeaders.getRange()| Constructor and Description |
|---|
HttpRange() |
| Modifier and Type | Method and Description |
|---|---|
static HttpRange |
createByteRange(long firstBytePos)
Create an
HttpRange from the given position to the end. |
static HttpRange |
createByteRange(long firstBytePos,
long lastBytePos)
Create a
HttpRange from the given fist to last position. |
static HttpRange |
createSuffixRange(long suffixLength)
Create an
HttpRange that ranges over the last given number of bytes. |
abstract long |
getRangeEnd(long length)
Return the end of the range (inclusive) given the total length of a representation.
|
abstract long |
getRangeStart(long length)
Return the start of the range given the total length of a representation.
|
static List<HttpRange> |
parseRanges(String ranges)
Parse the given, comma-separated string into a list of
HttpRange objects. |
static String |
toString(Collection<HttpRange> ranges)
Return a string representation of the given list of
HttpRange objects. |
public abstract long getRangeStart(long length)
length - the length of the representationpublic abstract long getRangeEnd(long length)
length - the length of the representationpublic static HttpRange createByteRange(long firstBytePos)
HttpRange from the given position to the end.firstBytePos - the first byte positionfirstPos till the endpublic static HttpRange createByteRange(long firstBytePos, long lastBytePos)
HttpRange from the given fist to last position.firstBytePos - the first byte positionlastBytePos - the last byte positionfirstPos till lastPospublic static HttpRange createSuffixRange(long suffixLength)
HttpRange that ranges over the last given number of bytes.suffixLength - the number of bytes for the rangesuffixLength number of bytespublic static List<HttpRange> parseRanges(String ranges)
HttpRange objects.
This method can be used to parse an Range header.
ranges - the string to parseIllegalArgumentException - if the string cannot be parsedpublic static String toString(Collection<HttpRange> ranges)
HttpRange objects.
This method can be used to for an Range header.
ranges - the ranges to create a string of