Package com.helix.core.cache.l4
Class BytecodeCodec
java.lang.Object
com.helix.core.cache.l4.BytecodeCodec
Binary serialization codec for compiled JVM rule bytecode and associated metadata.
Uses a compact binary framing format with the magic header 0x48454C58 ("HELX").
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcalculateRuleHash(String ruleContent) Calculates a deterministic SHA-256 hash for rule content using RuleKeyHasher.static SerializedRuleDatadecode(byte[] bytes) Deserializes a binary payload into a SerializedRuleData instance.static byte[]encode(SerializedRuleData data) Serializes a SerializedRuleData instance into a binary payload.
-
Field Details
-
MAGIC_HEADER
public static final int MAGIC_HEADER- See Also:
-
FORMAT_VERSION_1
public static final short FORMAT_VERSION_1- See Also:
-
-
Method Details
-
encode
Serializes a SerializedRuleData instance into a binary payload.- Parameters:
data- rule metadata and bytecode- Returns:
- serialized binary array
-
decode
Deserializes a binary payload into a SerializedRuleData instance.- Parameters:
bytes- serialized binary array- Returns:
- deserialized SerializedRuleData
- Throws:
IllegalArgumentException- if payload has invalid magic header or is corrupted/truncated
-
calculateRuleHash
Calculates a deterministic SHA-256 hash for rule content using RuleKeyHasher.- Parameters:
ruleContent- raw rule definition or expression- Returns:
- 64-character lowercase hexadecimal hash
-