Class StrictJson
java.lang.Object
zeroecho.pki.server.http.StrictJson
Strict bounded UTF-8 JSON framing shared by server configuration and HTTP.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAbsolute technical JSON document ceiling. -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]encode(PkiOperationValue value) Encodes one safe operation value deterministically as UTF-8 JSON.static PkiOperationValueparse(byte[] document, int maximumBytes) Parses exactly one complete strict JSON value with duplicate detection.
-
Field Details
-
MAXIMUM_DOCUMENT_BYTES
public static final int MAXIMUM_DOCUMENT_BYTESAbsolute technical JSON document ceiling.- See Also:
-
-
Method Details
-
parse
Parses exactly one complete strict JSON value with duplicate detection.- Parameters:
document- non-empty UTF-8 JSON without a byte-order markmaximumBytes- positive caller limit, no greater thanMAXIMUM_DOCUMENT_BYTES- Returns:
- immutable operation-value representation
- Throws:
IllegalArgumentException- if framing, size, encoding, or JSON syntax is invalid
-
encode
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
-