Class BulkPayloadEstimator

java.lang.Object
ai.attackframework.tools.burp.sinks.BulkPayloadEstimator

public final class BulkPayloadEstimator extends Object
Estimates approximate JSON payload size for bulk index requests. Used to flush batches by payload size (e.g. 5 MB) in addition to doc count.
  • Method Details

    • estimateBytes

      public static long estimateBytes(Map<String,Object> doc)
      Estimates the approximate byte size of a document when serialized as JSON. Counts key names, string values (UTF-8 length), and rough size for numbers/booleans/null; recurses into nested maps and lists. Underestimates actual bulk JSON (no commas, braces overhead) but is sufficient to cap batch payload size.
      Parameters:
      doc - document to estimate (can be null)
      Returns:
      estimated size in bytes, or 0 if doc is null