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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
decode(byte[] serialized, Collection<T> out)
This is used seldomly as the canonical message form is alist
.List<T>
decodeList(byte[] serialized)
Convenience method fordecodeList(byte[], Collection)
boolean
decodeList(byte[] serialized, Collection<T> out)
Returnstrue
if an element was decoded or throwsIllegalArgumentException
.T
decodeOne(byte[] serialized)
Visible for testing.Encoding
encoding()
-
-
-
Method Detail
-
encoding
Encoding encoding()
-
decode
boolean decode(byte[] serialized, Collection<T> out)
This is used seldomly 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
@Nullable T decodeOne(byte[] serialized)
Visible for testing. This returns the first element parsed from the serialized object or null
-
decodeList
boolean decodeList(byte[] serialized, Collection<T> out)
Returnstrue
if an element was decoded or throwsIllegalArgumentException
.
-
decodeList
List<T> decodeList(byte[] serialized)
Convenience method fordecodeList(byte[], Collection)
-
-