RangesSpecifier

data class RangesSpecifier(val unit: String = RangeUnits.Bytes.unitToken, val ranges: List<ContentRange>)

Range specifier for partial content requests (RFC 2616 sec 14.35.1)

Constructors

Link copied to clipboard
constructor(unit: RangeUnits, ranges: List<ContentRange>)
constructor(unit: String = RangeUnits.Bytes.unitToken, ranges: List<ContentRange>)

Properties

Link copied to clipboard

a list of requested ranges (could be open or closed ranges)

Link copied to clipboard

range units, usually bytes

Functions

Link copied to clipboard
fun isValid(rangeUnitPredicate: (String) -> Boolean = { it == RangeUnits.Bytes.unitToken }): Boolean

Verify ranges

Link copied to clipboard
fun merge(length: Long): List<LongRange>

Merges all overlapping and neighbours ranges. Currently gaps collapse is not supported but should be, one day.

fun merge(length: Long, maxRangeCount: Int = 50): List<LongRange>

Resolve and merge all overlapping and neighbours ranges

Link copied to clipboard

Merge all ranges into a single absolute long range

Link copied to clipboard
open override fun toString(): String