Class BaggageCodec

java.lang.Object
io.opentelemetry.api.baggage.propagation.BaggageCodec

class BaggageCodec extends Object
Note: This class is based on code from Apache Commons Codec. It is comprised of code from these classes:

Implements baggage-octet decoding in accordance with th Baggage header content specification. All US-ASCII characters excluding CTLs, whitespace, DQUOTE, comma, semicolon and backslash are encoded in `www-form-urlencoded` encoding scheme.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final byte
     
    private static final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static byte[]
    decode(byte[] bytes)
    Decodes an array of URL safe 7-bit characters into an array of original bytes.
    (package private) static String
    decode(String value, Charset charset)
    Decodes an array of URL safe 7-bit characters into an array of original bytes.
    private static int
    digit16(byte b)
    Returns the numeric value of the character b in radix 16.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BaggageCodec

      private BaggageCodec()
  • Method Details

    • decode

      private static byte[] decode(byte[] bytes)
      Decodes an array of URL safe 7-bit characters into an array of original bytes. Escaped characters are converted back to their original representation.
      Parameters:
      bytes - array of URL safe characters
      Returns:
      array of original bytes
    • decode

      static String decode(String value, Charset charset)
      Decodes an array of URL safe 7-bit characters into an array of original bytes. Escaped characters are converted back to their original representation.
      Parameters:
      value - string of URL safe characters
      charset - encoding of given string
      Returns:
      decoded value
    • digit16

      private static int digit16(byte b)
      Returns the numeric value of the character b in radix 16.
      Parameters:
      b - The byte to be converted.
      Returns:
      The numeric value represented by the character in radix 16.