RangesSpecifier

data class RangesSpecifier

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

Constructors

<init>

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

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

Properties

ranges

val ranges: List<ContentRange>

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

unit

val unit: String

range units, usually bytes

Functions

isValid

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

Verify ranges

merge

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

Resolve and merge all overlapping and neighbours ranges

fun merge(length: Long): List<LongRange>

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

mergeToSingle

fun mergeToSingle(length: Long): LongRange?

Merge all ranges into a single absolute long range

toString

fun toString(): String