Class ContentByteRange

java.lang.Object
org.duracloud.storage.domain.ContentByteRange

public class ContentByteRange extends Object
Handles the parsing and validation of HTTP Range headers for Range-based content requests
Author:
Bill Branan Date: 4/20/18
  • Constructor Summary

    Constructors
    Constructor
    Description
    Captures the start and end values described in an HTTP Range header
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the ending point of the byte range (the number following the "-"), or null if there is no number following the dash
    Gets the starting point of the byte range (the number preceding the "-"), or null if there is no number preceding the dash
    Provides text describing how the Range header value is to be used, and noting that the provided range is invalid.
    protected void
    Parses the Range HTTP header value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ContentByteRange

      public ContentByteRange(String range)
      Captures the start and end values described in an HTTP Range header
      Parameters:
      range - HTTP Range header with format 'bytes=X-Y'
  • Method Details

    • getRangeStart

      public Long getRangeStart()
      Gets the starting point of the byte range (the number preceding the "-"), or null if there is no number preceding the dash
    • getRangeEnd

      public Long getRangeEnd()
      Gets the ending point of the byte range (the number following the "-"), or null if there is no number following the dash
    • parseRange

      protected void parseRange(String range)
      Parses the Range HTTP header value. Only a single range is supported (others are dropped).
      Parameters:
      range - Range header included in HTTP request
      Throws:
      IllegalArgumentException - if range value is not valid
    • getUsage

      public String getUsage(String range)
      Provides text describing how the Range header value is to be used, and noting that the provided range is invalid.
      Parameters:
      range - invalid range value
      Returns: