Class CollectionJson
- Namespace
- EncDotNet.S100.Collections.Persistence
- Assembly
- EncDotNet.S100.Collections.dll
JSON (de)serialization of collection definitions and source indexes.
public static class CollectionJson
- Inheritance
-
CollectionJson
- Inherited Members
Remarks
Collection definitions are small, user-meaningful, and written indented.
Source indexes can be large (thousands of coverage polygons), so they are
written compactly and gzip-compressed, with each vertex encoded as a
[latitude, longitude] pair.
Hosts own file placement and atomic replacement; this class only converts to and from streams and strings.
Properties
IndexOptions
Options for source indexes (compact, camelCase).
public static JsonSerializerOptions IndexOptions { get; }
Property Value
StoreOptions
Options for collection definitions (indented, camelCase).
public static JsonSerializerOptions StoreOptions { get; }
Property Value
Methods
DeserializeStore(string)
Deserializes a collection store document.
public static CollectionStoreDocument DeserializeStore(string json)
Parameters
jsonstring
Returns
Exceptions
- JsonException
The JSON is malformed.
- NotSupportedException
The document is from a newer, unknown format version.
ReadIndex(Stream)
Reads a gzip-compressed source index from stream.
public static SourceIndex ReadIndex(Stream stream)
Parameters
streamStream
Returns
Exceptions
- JsonException
The content is malformed.
- InvalidDataException
The content is not gzip-compressed.
SerializeStore(CollectionStoreDocument)
Serializes a collection store document.
public static string SerializeStore(CollectionStoreDocument document)
Parameters
documentCollectionStoreDocument
Returns
WriteIndex(Stream, SourceIndex)
Writes a gzip-compressed source index to stream.
public static void WriteIndex(Stream stream, SourceIndex index)
Parameters
streamStreamindexSourceIndex