@Immutable public final class SpanId extends Object implements Comparable<SpanId>
| Modifier and Type | Field and Description |
|---|---|
static SpanId |
INVALID
The invalid
SpanId. |
static int |
SIZE
The size in bytes of the
SpanId. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SpanId that) |
void |
copyBytesTo(byte[] dest,
int destOffset)
Copies the byte array representations of the
SpanId into the dest beginning at
the destOffset offset. |
boolean |
equals(Object obj) |
static SpanId |
fromBytes(byte[] buffer)
Returns a
SpanId built from a byte representation. |
static SpanId |
fromBytes(byte[] src,
int srcOffset)
Returns a
SpanId whose representation is copied from the src beginning at the
srcOffset offset. |
static SpanId |
generateRandomId(Random random)
Generates a new random
SpanId. |
byte[] |
getBytes()
Returns the byte representation of the
SpanId. |
int |
hashCode() |
boolean |
isValid()
Returns whether the span identifier is valid.
|
String |
toString() |
public static final int SIZE
SpanId.public static final SpanId INVALID
SpanId. All bytes are 0.public static SpanId fromBytes(byte[] buffer)
SpanId built from a byte representation.
Equivalent with:
SpanId.fromBytes(buffer, 0);
buffer - the representation of the SpanId.SpanId whose representation is given by the buffer parameter.NullPointerException - if buffer is null.IllegalArgumentException - if buffer.length is not SIZE.public static SpanId fromBytes(byte[] src, int srcOffset)
SpanId whose representation is copied from the src beginning at the
srcOffset offset.src - the buffer where the representation of the SpanId is copied.srcOffset - the offset in the buffer where the representation of the SpanId
begins.SpanId whose representation is copied from the buffer.NullPointerException - if src is null.IndexOutOfBoundsException - if srcOffset+SpanId.SIZE is greater than src.length.public static SpanId generateRandomId(Random random)
SpanId.random - The random number generator.SpanId.public byte[] getBytes()
SpanId.SpanId.public void copyBytesTo(byte[] dest,
int destOffset)
SpanId into the dest beginning at
the destOffset offset.
Equivalent with (but faster because it avoids any new allocations):
System.arraycopy(getBytes(), 0, dest, destOffset, SpanId.SIZE);
dest - the destination buffer.destOffset - the starting offset in the destination buffer.NullPointerException - if dest is null.IndexOutOfBoundsException - if destOffset+SpanId.SIZE is greater than dest.length.public boolean isValid()
true if the span identifier is valid.public int compareTo(SpanId that)
compareTo in interface Comparable<SpanId>