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 Details

    • encoding

      Encoding encoding()
    • decode

      boolean decode​(byte[] serialized, Collection<T> out)
      This is used seldomly as the canonical message form is a list.

      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)
      Returns:
      true if an element was decoded
    • decodeList

      List<T> decodeList​(byte[] serialized)
      Convenience method for decodeList(byte[], Collection)