Package zipkin2.codec
Interface BytesDecoder<T>
- Type Parameters:
T
- type of the object to deserialize
- All Known Implementing Classes:
DependencyLinkBytesDecoder
,SpanBytesDecoder
public interface BytesDecoder<T>
This type accepts a collection that receives decoded elements.
ArrayList<Span> out = new ArrayList<>();
SpanBytesDecoder.JSON_V2.decodeList(spans, out)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
decode
(byte[] serialized, Collection<T> out) This is used seldom as the canonical message form is alist
.decodeList
(byte[] serialized) Convenience method fordecodeList(byte[], Collection)
boolean
decodeList
(byte[] serialized, Collection<T> out) Returnstrue
if an element was decoded or throwsIllegalArgumentException
.decodeOne
(byte[] serialized) Visible for testing.encoding()
-
Method Details
-
encoding
Encoding encoding() -
decode
This is used seldom as the canonical message form is alist
.Note: multiple elements can be consumed from a single serialized object. For example, if the input is Zipkin v1, the list might receive two elements if the serialized object was a shared span.
- Parameters:
serialized
- a single message, for example a json object- Returns:
- true if an element was decoded
-
decodeOne
Visible for testing. This returns the first element parsed from the serialized object or null -
decodeList
Returnstrue
if an element was decoded or throwsIllegalArgumentException
. -
decodeList
Convenience method fordecodeList(byte[], Collection)
-