Class Range

  • All Implemented Interfaces:
    HeaderOption

    public class Range
    extends Object
    implements HeaderOption
    A Range is used to get portions of data by using one or more range specifications.
    Author:
    Jeremy Unruh
    • Field Detail

      • offset

        protected long offset
      • length

        protected long length
    • Method Detail

      • last

        public static Range last​(long lastBytes)
        Return only the last N bytes of data
        Parameters:
        lastBytes - the last N bytes to return
        Returns:
        the range object
      • first

        public static Range first​(long maxBytes)
        Return only bytes starting from 0 to maxBytes of data
        Parameters:
        maxBytes - the max bytes to download
        Returns:
        the range object
      • startAt

        public static Range startAt​(long offset)
        Return all bytes after the specified offset of data
        Parameters:
        offset - the starting pointer
        Returns:
        the range object
      • from

        public static Range from​(long offset,
                                 long lastByte)
        Return bytes only from offset in bytes to the specified lastByte
        Parameters:
        offset - the starting pointer
        lastByte - the last byte
        Returns:
        the range object
      • value

        public String value()