RangedUri
@UnstableApi
public final class RangedUri
Defines a range of data located at a reference uri.
Summary
Public fields |
|
|---|---|
final long |
The length of the range, or |
final long |
The (zero based) index of the first byte of the range. |
Public constructors |
|---|
|
Constructs an ranged uri. |
Public methods |
|
|---|---|
@Nullable RangedUri |
attemptMerge(@Nullable RangedUri other, String baseUri)Attempts to merge this |
boolean |
|
int |
hashCode() |
Uri |
resolveUri(String baseUri)Returns the resolved |
String |
resolveUriString(String baseUri)Returns the resolved uri represented by the instance as a string. |
String |
toString() |
Public fields
length
public final long length
The length of the range, or LENGTH_UNSET to indicate that the range is unbounded.
Public constructors
RangedUri
public RangedUri(@Nullable String referenceUri, long start, long length)
Constructs an ranged uri.
| Parameters | |
|---|---|
@Nullable String referenceUri |
The reference uri. |
long start |
The (zero based) index of the first byte of the range. |
long length |
The length of the range, or |
Public methods
attemptMerge
public @Nullable RangedUri attemptMerge(@Nullable RangedUri other, String baseUri)
Attempts to merge this RangedUri with another and an optional common base uri.
A merge is successful if both instances define the same Uri after resolution with the base uri, and if one starts the byte after the other ends, forming a contiguous region with no overlap.
If other is null then the merge is considered unsuccessful, and null is returned.
resolveUri
public Uri resolveUri(String baseUri)
Returns the resolved Uri represented by the instance.
| Parameters | |
|---|---|
String baseUri |
The base Uri. |
resolveUriString
public String resolveUriString(String baseUri)
Returns the resolved uri represented by the instance as a string.
| Parameters | |
|---|---|
String baseUri |
The base Uri. |
| Returns | |
|---|---|
String |
The uri represented by the instance. |