Class BytecodeCodec

java.lang.Object
com.helix.core.cache.l4.BytecodeCodec

public final class BytecodeCodec extends Object
Binary serialization codec for compiled JVM rule bytecode and associated metadata. Uses a compact binary framing format with the magic header 0x48454C58 ("HELX").
  • Field Details

  • Method Details

    • encode

      public static byte[] encode(SerializedRuleData data)
      Serializes a SerializedRuleData instance into a binary payload.
      Parameters:
      data - rule metadata and bytecode
      Returns:
      serialized binary array
    • decode

      public static SerializedRuleData decode(byte[] bytes)
      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

      public static String calculateRuleHash(String ruleContent)
      Calculates a deterministic SHA-256 hash for rule content using RuleKeyHasher.
      Parameters:
      ruleContent - raw rule definition or expression
      Returns:
      64-character lowercase hexadecimal hash