All Downloads are FREE. Search and download functionalities are using the official Maven repository.

skadistats.clarity.io.decoder.PointerDecoder Maven / Gradle / Ivy

package skadistats.clarity.io.decoder;

import skadistats.clarity.io.bitstream.BitStream;
import skadistats.clarity.io.s2.Pointer;
import skadistats.clarity.io.s2.SerializerId;

public class PointerDecoder implements Decoder {

    private final SerializerId[] types;

    public PointerDecoder(SerializerId[] types) {
        this.types = types;
    }

    @Override
    public Pointer decode(BitStream bs) {
        var enabled = bs.readBitFlag();
        Integer index = null;
        if (enabled && types.length > 1) {
            index = bs.readUBitVar();
        }
        var description = index == null ? "null" : types[index].toString();
        return new Pointer(index, description);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy