Package io.opencensus.tags.propagation
Class TagContextBinarySerializer
java.lang.Object
io.opencensus.tags.propagation.TagContextBinarySerializer
- Direct Known Subclasses:
NoopTags.NoopTagContextBinarySerializer
,TagContextBinarySerializerImpl
Object for serializing and deserializing
TagContext
s with the binary format.
See opencensus-specs for the specification of the cross-language binary serialization format.
- Since:
- 0.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TagContext
fromByteArray
(byte[] bytes) Creates aTagContext
from the given on-the-wire encoded representation.abstract byte[]
toByteArray
(TagContext tags) Serializes theTagContext
into the on-the-wire representation.
-
Constructor Details
-
TagContextBinarySerializer
public TagContextBinarySerializer()
-
-
Method Details
-
toByteArray
Serializes theTagContext
into the on-the-wire representation.This method should be the inverse of
fromByteArray(byte[])
.Tag
s that have aTagMetadata
withTagMetadata.TagTtl.NO_PROPAGATION
will not be serialized.- 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.- Since:
- 0.8
-
fromByteArray
Creates aTagContext
from the given on-the-wire encoded representation.This method should be the inverse of
toByteArray(io.opencensus.tags.TagContext)
.- 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.- Since:
- 0.8
-