Class TraceOptions
java.lang.Object
io.opencensus.trace.TraceOptions
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intstatic final TraceOptionsThe defaultTraceOptions.private static final byteprivate static final byteprivate final bytestatic final intThe size in bytes of theTraceOptions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TraceOptions.Builderbuilder()Returns a newTraceOptions.Builderwith default options.static TraceOptions.Builderbuilder(TraceOptions traceOptions) Returns a newTraceOptions.Builderwith all given options set.voidcopyBytesTo(byte[] dest, int destOffset) Copies the byte representations of theTraceOptionsinto thedestbeginning at thedestOffsetoffset.voidcopyLowerBase16To(char[] dest, int destOffset) Copies the lowercase base16 representations of theTraceIdinto thedestbeginning at thedestOffsetoffset.booleanstatic TraceOptionsfromByte(byte src) Returns aTraceOptionswhose representation issrc.static TraceOptionsfromBytes(byte[] buffer) Deprecated.static TraceOptionsfromBytes(byte[] src, int srcOffset) Deprecated.usefromByte(byte).static TraceOptionsfromLowerBase16(CharSequence src, int srcOffset) Returns aTraceOptionbuilt from a lowercase base16 representation.bytegetByte()Returns the one byte representation of theTraceOptions.byte[]getBytes()Deprecated.usegetByte().(package private) byteinthashCode()private booleanhasOption(int mask) booleanReturns a boolean indicating whether thisSpanis part of a sampled trace and data should be exported to a persistent store.Returns the lowercase base16 encoding of thisTraceOptions.toString()
-
Field Details
-
DEFAULT_OPTIONS
private static final byte DEFAULT_OPTIONS- See Also:
-
IS_SAMPLED
private static final byte IS_SAMPLED- See Also:
-
SIZE
public static final int SIZEThe size in bytes of theTraceOptions.- Since:
- 0.5
- See Also:
-
BASE16_SIZE
private static final int BASE16_SIZE- See Also:
-
DEFAULT
-
options
private final byte options
-
-
Constructor Details
-
TraceOptions
private TraceOptions(byte options)
-
-
Method Details
-
fromBytes
Deprecated.usefromByte(byte).Returns aTraceOptionsbuilt from a byte representation.Equivalent with:
TraceOptions.fromBytes(buffer, 0);- Parameters:
buffer- the representation of theTraceOptions.- Returns:
- a
TraceOptionswhose representation is given by thebufferparameter. - Throws:
NullPointerException- ifbufferis null.IllegalArgumentException- ifbuffer.lengthis notSIZE.- Since:
- 0.5
-
fromBytes
Deprecated.usefromByte(byte).Returns aTraceOptionswhose representation is copied from thesrcbeginning at thesrcOffsetoffset.- Parameters:
src- the buffer where the representation of theTraceOptionsis copied.srcOffset- the offset in the buffer where the representation of theTraceOptionsbegins.- Returns:
- a
TraceOptionswhose representation is copied from the buffer. - Throws:
NullPointerException- ifsrcis null.IndexOutOfBoundsException- ifsrcOffset+TraceOptions.SIZEis greater thansrc.length.- Since:
- 0.5
-
fromByte
Returns aTraceOptionswhose representation issrc.- Parameters:
src- the byte representation of theTraceOptions.- Returns:
- a
TraceOptionswhose representation issrc. - Since:
- 0.16
-
fromLowerBase16
Returns aTraceOptionbuilt from a lowercase base16 representation.- Parameters:
src- the lowercase base16 representation.srcOffset- the offset in the buffer where the representation of theTraceOptionsbegins.- Returns:
- a
TraceOptionbuilt from a lowercase base16 representation. - Throws:
NullPointerException- ifsrcis null.IllegalArgumentException- ifsrc.lengthis not2 * TraceOption.SIZEOR if thestrhas invalid characters.- Since:
- 0.18
-
getByte
public byte getByte()Returns the one byte representation of theTraceOptions.- Returns:
- the one byte representation of the
TraceOptions. - Since:
- 0.16
-
getBytes
Deprecated.usegetByte().Returns the 1-byte array representation of theTraceOptions.- Returns:
- the 1-byte array representation of the
TraceOptions. - Since:
- 0.5
-
copyBytesTo
public void copyBytesTo(byte[] dest, int destOffset) Copies the byte representations of theTraceOptionsinto thedestbeginning at thedestOffsetoffset.Equivalent with (but faster because it avoids any new allocations):
System.arraycopy(getBytes(), 0, dest, destOffset, TraceOptions.SIZE);- Parameters:
dest- the destination buffer.destOffset- the starting offset in the destination buffer.- Throws:
NullPointerException- ifdestis null.IndexOutOfBoundsException- ifdestOffset+TraceOptions.SIZEis greater thandest.length.- Since:
- 0.5
-
copyLowerBase16To
public void copyLowerBase16To(char[] dest, int destOffset) Copies the lowercase base16 representations of theTraceIdinto thedestbeginning at thedestOffsetoffset.- Parameters:
dest- the destination buffer.destOffset- the starting offset in the destination buffer.- Throws:
IndexOutOfBoundsException- ifdestOffset + 2is greater thandest.length.- Since:
- 0.18
-
toLowerBase16
Returns the lowercase base16 encoding of thisTraceOptions.- Returns:
- the lowercase base16 encoding of this
TraceOptions. - Since:
- 0.18
-
builder
Returns a newTraceOptions.Builderwith default options.- Returns:
- a new
Builderwith default options. - Since:
- 0.5
-
builder
Returns a newTraceOptions.Builderwith all given options set.- Parameters:
traceOptions- the given options set.- Returns:
- a new
Builderwith all given options set. - Since:
- 0.5
-
isSampled
public boolean isSampled()Returns a boolean indicating whether thisSpanis part of a sampled trace and data should be exported to a persistent store.- Returns:
- a boolean indicating whether the trace is sampled.
- Since:
- 0.5
-
equals
-
hashCode
-
toString
-
getOptions
byte getOptions() -
hasOption
private boolean hasOption(int mask)
-
fromByte(byte).