Class ByteRange
java.lang.Object
com.google.appengine.api.blobstore.ByteRange
A byte range as parsed from a request Range header. Format produced by this class is
also compatible with the X-AppEngine-BlobRange header, used for serving sub-ranges of
blobs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
TwoByteRange
objects are considered equal if they have the same start and end.long
getEnd()
Get end index of byte range.long
getStart()
Get start index of byte range.boolean
hasEnd()
Indicates whether or not this byte range indicates an end.int
hashCode()
static ByteRange
Parse byte range from header.static ByteRange
parseContentRange
(String contentRange) Parse content range from header for byte-range only.toString()
Format byte range for use in header.
-
Constructor Details
-
ByteRange
public ByteRange(long start) Constructor.- Parameters:
start
- Start index of blob range to serve. If negative, serve the last abs(start) bytes of the blob.
-
ByteRange
public ByteRange(long start, long end) Constructor.- Parameters:
start
- Start index of blob range to serve. May not be negative.end
- End index of blob range to serve. Index is inclusive, meaning the byte indicated by end is included in the response.
-
-
Method Details
-
hasEnd
public boolean hasEnd()Indicates whether or not this byte range indicates an end.- Returns:
- true if byte range has an end.
-
getStart
public long getStart()Get start index of byte range.- Returns:
- Start index of byte range.
-
getEnd
public long getEnd()Get end index of byte range.- Returns:
- End index of byte range.
- Throws:
IllegalStateException
- if byte range does not have an end range.
-
toString
Format byte range for use in header. -
parse
Parse byte range from header.- Parameters:
byteRange
- Byte range string as received from header.- Returns:
- ByteRange object set to byte range as parsed from string.
- Throws:
RangeFormatException
- Unable to parse header because of invalid format.UnsupportedRangeFormatException
- Header is a valid HTTP range header, the specific form is not supported by app engine. This includes unit types other than "bytes" and multiple ranges.
-
parseContentRange
Parse content range from header for byte-range only.- Parameters:
contentRange
- Content range string as received from header.- Returns:
- ByteRange object set to byte range as parsed from string, but does not include the size information.
- Throws:
RangeFormatException
- Unable to parse header because of invalid format.
-
hashCode
public int hashCode() -
equals
TwoByteRange
objects are considered equal if they have the same start and end.
-