public class 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.
Static Methods
parse(String byteRange)
public static ByteRange parse(String byteRange)
Parse byte range from header.
Parameter | |
---|---|
Name | Description |
byteRange |
String Byte range string as received from header. |
Returns | |
---|---|
Type | Description |
ByteRange |
ByteRange object set to byte range as parsed from string. |
parseContentRange(String contentRange)
public static ByteRange parseContentRange(String contentRange)
Parse content range from header for byte-range only.
Parameter | |
---|---|
Name | Description |
contentRange |
String Content range string as received from header. |
Returns | |
---|---|
Type | Description |
ByteRange |
ByteRange object set to byte range as parsed from string, but does not include the size information. |
Constructors
ByteRange(long start)
public ByteRange(long start)
Constructor.
Parameter | |
---|---|
Name | Description |
start |
long Start index of blob range to serve. If negative, serve the last abs(start) bytes of the blob. |
ByteRange(long start, @Nullable Long end)
protected ByteRange(long start, @Nullable Long end)
Parameters | |
---|---|
Name | Description |
start |
long |
end |
@org.checkerframework.checker.nullness.qual.Nullable java.lang.Long |
ByteRange(long start, long end)
public ByteRange(long start, long end)
Constructor.
Parameters | |
---|---|
Name | Description |
start |
long Start index of blob range to serve. May not be negative. |
end |
long End index of blob range to serve. Index is inclusive, meaning the byte indicated by end is included in the response. |
Methods
equals(@Nullable Object object)
public boolean equals(@Nullable Object object)
Two ByteRange
objects are considered equal if they have the same start and end.
Parameter | |
---|---|
Name | Description |
object |
@org.checkerframework.checker.nullness.qual.Nullable java.lang.Object |
Returns | |
---|---|
Type | Description |
boolean |
getEnd()
public long getEnd()
Get end index of byte range.
Returns | |
---|---|
Type | Description |
long |
End index of byte range. |
getStart()
public long getStart()
Get start index of byte range.
Returns | |
---|---|
Type | Description |
long |
Start index of byte range. |
hasEnd()
public boolean hasEnd()
Indicates whether or not this byte range indicates an end.
Returns | |
---|---|
Type | Description |
boolean |
true if byte range has an end. |
hashCode()
public int hashCode()
Returns | |
---|---|
Type | Description |
int |
toString()
public String toString()
Format byte range for use in header.
Returns | |
---|---|
Type | Description |
String |