IDS peak ICV v1.5.0
Loading...
Searching...
No Matches
Serializer Class Reference
Inheritance diagram for Serializer:

Public Member Functions

 Serializer (SerializationType type=SerializationType.Json)
 Constructs a Serializer with the specified serialization type.
 
void Write (IArchive archive, Stream stream)
 Serializes an archive and writes it to a stream.
 

Detailed Description

Serializer for writing IArchive objects to an output stream.

This class converts an IArchive object into a specific serialization format and writes the result to a stream.

var archive = new Archive();
archive.SetInt64("id", 42);
archive.SetString("name", "example");
using var file = new FileStream("archive.json", FileMode.Create);
var serializer = new Serializer(SerializationType.Json);
serializer.Write(archive, file);
A key-value store that implements the IArchive interface.
Definition Archive.cs:39
Serializer(SerializationType type=SerializationType.Json)
Constructs a Serializer with the specified serialization type.
Definition Serializer.cs:43
SerializationType
Enumeration of supported serialization formats.
Definition SerializationType.cs:19
Since
IDSImaging.Peak.ICV 1.3

Constructor & Destructor Documentation

◆ Serializer()

Constructs a Serializer with the specified serialization type.

The chosen format determines how the archive is written when Write() is called. If no type is provided, JSON is used by default.

Parameters
typeThe serialization format to use (defaults to SerializationType.Json).
Since
IDSImaging.Peak.ICV 1.3

Member Function Documentation

◆ Write()

void Write ( IArchive archive,
Stream stream )
inline

Serializes an archive and writes it to a stream.

Converts the given IArchive object into the configured format and writes the serialized data to the provided stream.

Parameters
archiveThe archive to serialize.
streamThe stream that receives the serialized data.
Exceptions
IcvNotSupportedExceptionThe serialization type is not supported.
Since
IDSImaging.Peak.ICV 1.3

Implements ISerializer.