Class ByteRange (2.0.0)

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.

Inheritance

java.lang.Object > ByteRange

Static Methods

parse(String byteRange)

public static ByteRange parse(String byteRange)

Parse byte range from header.

Parameter
NameDescription
byteRangeString

Byte range string as received from header.

Returns
TypeDescription
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
NameDescription
contentRangeString

Content range string as received from header.

Returns
TypeDescription
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
NameDescription
startlong

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
NameDescription
startlong
end@org.checkerframework.checker.nullness.qual.Nullable java.lang.Long

ByteRange(long start, long end)

public ByteRange(long start, long end)

Constructor.

Parameters
NameDescription
startlong

Start index of blob range to serve. May not be negative.

endlong

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
NameDescription
object@org.checkerframework.checker.nullness.qual.Nullable java.lang.Object
Returns
TypeDescription
boolean
Overrides

getEnd()

public long getEnd()

Get end index of byte range.

Returns
TypeDescription
long

End index of byte range.

getStart()

public long getStart()

Get start index of byte range.

Returns
TypeDescription
long

Start index of byte range.

hasEnd()

public boolean hasEnd()

Indicates whether or not this byte range indicates an end.

Returns
TypeDescription
boolean

true if byte range has an end.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

toString()

public String toString()

Format byte range for use in header.

Returns
TypeDescription
String
Overrides