Class StatusTypeValuesBuilder

java.lang.Object
com.authlete.cbor.tsl.StatusTypeValuesBuilder

public class StatusTypeValuesBuilder extends Object
A utility class to construct the compressed byte array of a token status list.
Since:
1.21
See Also:
  • Constructor Details

    • StatusTypeValuesBuilder

      public StatusTypeValuesBuilder(int bits)
      A constructor with bits.
      Parameters:
      bits - The number of bits per Referenced Token. The allowed values for bits are 1, 2, 4 and 8.
  • Method Details

    • getBits

      public int getBits()
      Get the number of bits per Referenced Token.
      Returns:
      The number of bits per Referenced Token.
    • valueAt

      public StatusTypeValuesBuilder valueAt(StatusTypeValue value, int index)
      Set the value at the index.
      Parameters:
      value - The value to set.
      index - The index to set the value at.
      Returns:
      this object.
    • valueAt

      public StatusTypeValuesBuilder valueAt(int value, int index)
      Set the value at the index.
      Parameters:
      value - The value to set.
      index - The index to set the value at.
      Returns:
      this object.
    • build

      public byte[] build()
      Construct the status values.

      Note that the returned value is compressed using DEFLATE with the zlib data format, as required by the specification.

      Returns:
      The status values.
    • build

      public byte[] build(boolean compressed)
      Construct the status values.
      Parameters:
      compressed - true to compress the byte array representing the status values. Note that the Token Status List specification requires compression. The reason for allowing false is only for debugging purposes.
      Returns:
      The status values.