RangesSpecifier

data class RangesSpecifier(unit: String, ranges: List<ContentRange>)

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

Constructors

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

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
fun mergeToSingle(length: Long): LongRange?

Merge all ranges into a single absolute long range

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

Properties

Link copied to clipboard
val ranges: List<ContentRange>

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

Link copied to clipboard
val unit: String

range units, usually bytes