Package org.duracloud.storage.domain
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 ContentByteRange(String range)Captures the start and end values described in an HTTP Range header
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LonggetRangeEnd()Gets the ending point of the byte range (the number following the "-"), or null if there is no number following the dashLonggetRangeStart()Gets the starting point of the byte range (the number preceding the "-"), or null if there is no number preceding the dashStringgetUsage(String range)Provides text describing how the Range header value is to be used, and noting that the provided range is invalid.protected voidparseRange(String range)Parses the Range HTTP header value.
-
-
-
Constructor Detail
-
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 Detail
-
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
-
-