Class StatusTypeValuesBuilder
java.lang.Object
com.authlete.cbor.tsl.StatusTypeValuesBuilder
A utility class to construct the compressed byte array of a token status list.
- Since:
- 1.21
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]build()Construct the status values.byte[]build(boolean compressed) Construct the status values.intgetBits()Get the number of bits per Referenced Token.valueAt(int value, int index) Set the value at the index.valueAt(StatusTypeValue value, int index) Set the value at the index.
-
Constructor Details
-
StatusTypeValuesBuilder
public StatusTypeValuesBuilder(int bits) A constructor withbits.- Parameters:
bits- The number of bits per Referenced Token. The allowed values forbitsare 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
Set the value at the index.- Parameters:
value- The value to set.index- The index to set the value at.- Returns:
thisobject.
-
valueAt
Set the value at the index.- Parameters:
value- The value to set.index- The index to set the value at.- Returns:
thisobject.
-
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-trueto compress the byte array representing the status values. Note that the Token Status List specification requires compression. The reason for allowingfalseis only for debugging purposes.- Returns:
- The status values.
-