Class StrictJson

java.lang.Object
zeroecho.pki.server.http.StrictJson

public final class StrictJson extends Object
Strict bounded UTF-8 JSON framing shared by server configuration and HTTP.
  • Field Details

    • MAXIMUM_DOCUMENT_BYTES

      public static final int MAXIMUM_DOCUMENT_BYTES
      Absolute technical JSON document ceiling.
      See Also:
  • Method Details

    • parse

      public static PkiOperationValue parse(byte[] document, int maximumBytes)
      Parses exactly one complete strict JSON value with duplicate detection.
      Parameters:
      document - non-empty UTF-8 JSON without a byte-order mark
      maximumBytes - positive caller limit, no greater than MAXIMUM_DOCUMENT_BYTES
      Returns:
      immutable operation-value representation
      Throws:
      IllegalArgumentException - if framing, size, encoding, or JSON syntax is invalid
    • encode

      public static byte[] encode(PkiOperationValue value)
      Encodes one safe operation value deterministically as UTF-8 JSON.
      Parameters:
      value - safe operation value to encode
      Returns:
      newly allocated UTF-8 JSON bytes
      Throws:
      IllegalStateException - if the in-memory response cannot be encoded