Package ca.marcusdunn.jsonlens.mapped
@NullMarked
package ca.marcusdunn.jsonlens.mapped
A read-only JSON model over UTF-8 bytes, for example a memory-mapped file.
Open a file with MappedJson.open(java.nio.file.Path), or use bytes that are already in memory
with MappedJson.of(java.nio.ByteBuffer). Then give MappedJson.root() and
MappedJson.model() to the evaluator:
switch (MappedJson.open(Path.of("store.json"))) {
case Result.Ok(var json) -> {
var nodes = JsonPathEvaluator.standard().evaluate(query, json.root(), json.model());
}
case Result.Err(var error) -> System.err.println(error.message());
}
-
ClassDescriptionA JSON text in UTF-8 bytes, for example a memory-mapped file, with a read-only
JsonModel.The reason whyMappedJsoncannot read the bytes or the file.The file is too large.The bytes do not agree with the JSON grammar of RFC 8259.The bytes are not well-formed UTF-8 (RFC 3629).The file cannot be opened or mapped.A JSON value in aMappedJson.