Table of Contents

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

JsonSerializerOptions

StoreOptions

Options for collection definitions (indented, camelCase).

public static JsonSerializerOptions StoreOptions { get; }

Property Value

JsonSerializerOptions

Methods

DeserializeStore(string)

Deserializes a collection store document.

public static CollectionStoreDocument DeserializeStore(string json)

Parameters

json string

Returns

CollectionStoreDocument

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

stream Stream

Returns

SourceIndex

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

document CollectionStoreDocument

Returns

string

WriteIndex(Stream, SourceIndex)

Writes a gzip-compressed source index to stream.

public static void WriteIndex(Stream stream, SourceIndex index)

Parameters

stream Stream
index SourceIndex