Package 

Class ProvisioningCodec


  • 
    public final class ProvisioningCodec
    
                        

    Custom binary codec for ProvisioningInfo, replacing {@code ObjectInputStream}/ {@code ObjectOutputStream} on the disk-cache hot path.

    Format: a tagged TLV stream. Each field is written as {@code [uint16 fieldId][uint8 typeTag][value]}, terminated by {@code fieldId=FIELD_END=0}. Unknown field ids encountered by an older reader are skipped using the type tag — providing forward compatibility. Missing field ids leave the ProvisioningInfo default in place — providing backward compatibility.

    Adding a new field: assign the next unused FIELD_* constant, emit it in write, decode it in read. Never reuse a removed id.

    The format starts with a 4-byte magic (MAGIC) and 4-byte version int so legacy Java-serialized files (which start with {@code 0xAC 0xED}) can be distinguished and migrated via tryReadProvisioningInfo.