public interface JSONDataType extends DataType<JSON>
For efficiency, the JSON value is serialized in binary form following the CBOR specification.
The implementation provides support for binary
deltas.
DataTypes.json()| Modifier and Type | Method and Description |
|---|---|
DeltaType<JSON,BinaryDelta> |
binaryDeltaType()
Returns support for binary deltas.
|
JSON |
fromJsonString(String json)
Parse a JSON string.
|
JSON |
readValue(byte[] bytes)
Parse a value from CBOR-format binary.
|
JSON |
readValue(byte[] bytes,
int offset,
int length)
Parse a value from CBOR-format binary.
|
JSON |
readValue(Bytes bytes)
Parse a value from CBOR-format binary.
|
DeltaType<JSON,BinaryDelta> binaryDeltaType()
Equivalent to calling deltaType(BinaryDelta.class).
binaryDeltaType in interface DataType<JSON>JSON fromJsonString(String json) throws InvalidDataException
Precision for numeric types is lost in the translation to the internal
CBOR binary form and non-significant white space is not preserved. It is
not guaranteed that fromJsonString(json).toJsonString() equals
json.
InvalidDataException - if json does not represent a single JSON
valueJSON readValue(byte[] bytes, int offset, int length) throws IndexOutOfBoundsException
JSON instances defer parsing of binary data until required so this method
does not throw InvalidDataException. If the data is not valid, an
InvalidDataException may be thrown when a JSON method is
called.
readValue in interface DataType<JSON>bytes - the binary data. The implementation re-uses the array to avoid
copying. The caller must ensure the array is not modified.offset - start of the data within byteslength - length of the data within bytesIndexOutOfBoundsException - if either offset or
length is negative, or
offset + length > bytes.lengthDataType.validate(V)JSON readValue(byte[] bytes)
readValue(in, 0, in.length).Copyright © 2023 DiffusionData Limited. All rights reserved.