Class Range


  • public class Range
    extends Object
    Class specifying a range-request is being made.

    Request mostly follows https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35, except only one range is allowed. For the purposes of the SDK, three types of requests are supported:

    1. Exact range (0-100): All bytes in the given range
    2. Starts-at (100-): All bytes >= the start byte
    3. Last (-100): The last X bytes

    Also used to represent the range returned by the server (including the full content length, if known).

    • Method Detail

      • parse

        public static Range parse​(String value)
        Parse the “content-range” header per https://tools.ietf.org/html/rfc7233#section-4.2.

        Note, this is only for successful responses (206). It does not handle 416 (range not satisfiable).

        Parameters:
        value - The response header value.
        Returns:
        A new Range header.
      • getStartByte

        public Long getStartByte()
        The start byte, if given.
      • getEndByte

        public Long getEndByte()
        The end byte, if given.
      • getContentLength

        public Long getContentLength()
        The content length as returned by the server, or null if unknown.