Class StringSerializer
Type serializer for the string type. Writes and reads a single string token
without additional framing. null string values are passed directly to the writer;
the writer implementation is responsible for emitting a null token.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class StringSerializer : TypeSerializerBase<string>, ITypeSerializer<string>, ITypeSerializer
Remarks
Use the shared Instance singleton rather than creating new instances;
StringSerializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of StringSerializer.
Prefer this over allocating a new instance wherever a StringSerializer is needed.
Declaration
public static readonly StringSerializer Instance
Field Value
| Type | Description |
|---|---|
| StringSerializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a string value from the reader via ReadString().
Declaration
public override string Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at a string token. Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| string | The deserialized string, or |
Overrides
Write(string, IScyllaWriter, ISerializationContext)
Writes a string value to the output via WriteString(string).
Passing null is permitted; the writer is expected to emit a null token.
Declaration
public override void Write(string value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string to serialize, or |
| IScyllaWriter | writer | The writer that receives the serialized token. Never |
| ISerializationContext | context | The active serialization context. Never |