Class TagContextBinarySerializerImpl
- java.lang.Object
-
- io.opencensus.tags.propagation.TagContextBinarySerializer
-
- io.opencensus.implcore.tags.propagation.TagContextBinarySerializerImpl
-
final class TagContextBinarySerializerImpl extends TagContextBinarySerializer
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
EMPTY_BYTE_ARRAY
private CurrentState
state
-
Constructor Summary
Constructors Constructor Description TagContextBinarySerializerImpl(CurrentState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TagContext
fromByteArray(byte[] bytes)
Creates aTagContext
from the given on-the-wire encoded representation.byte[]
toByteArray(TagContext tags)
Serializes theTagContext
into the on-the-wire representation.
-
-
-
Field Detail
-
EMPTY_BYTE_ARRAY
private static final byte[] EMPTY_BYTE_ARRAY
-
state
private final CurrentState state
-
-
Constructor Detail
-
TagContextBinarySerializerImpl
TagContextBinarySerializerImpl(CurrentState state)
-
-
Method Detail
-
toByteArray
public byte[] toByteArray(TagContext tags) throws TagContextSerializationException
Description copied from class:TagContextBinarySerializer
Serializes theTagContext
into the on-the-wire representation.This method should be the inverse of
TagContextBinarySerializer.fromByteArray(byte[])
.Tag
s that have aTagMetadata
withTagMetadata.TagTtl.NO_PROPAGATION
will not be serialized.- Specified by:
toByteArray
in classTagContextBinarySerializer
- Parameters:
tags
- theTagContext
to serialize.- Returns:
- the on-the-wire representation of a
TagContext
. - Throws:
TagContextSerializationException
- if the result would be larger than the maximum allowed serialized size.
-
fromByteArray
public TagContext fromByteArray(byte[] bytes) throws TagContextDeserializationException
Description copied from class:TagContextBinarySerializer
Creates aTagContext
from the given on-the-wire encoded representation.This method should be the inverse of
TagContextBinarySerializer.toByteArray(io.opencensus.tags.TagContext)
.- Specified by:
fromByteArray
in classTagContextBinarySerializer
- Parameters:
bytes
- on-the-wire representation of aTagContext
.- Returns:
- a
TagContext
deserialized frombytes
. - Throws:
TagContextDeserializationException
- if there is a parse error, the input contains invalid tags, or the input is larger than the maximum allowed serialized size.
-
-