Class LongSerializer
Type serializer for the long primitive (signed 64-bit integer). Writes and reads a single long token without additional framing. Also used internally by TimeSpanSerializer to persist TimeSpan as a tick count.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class LongSerializer : TypeSerializerBase<long>, ITypeSerializer<long>, ITypeSerializer
Remarks
Use the shared Instance singleton rather than creating new instances;
LongSerializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of LongSerializer.
Prefer this over allocating a new instance wherever a LongSerializer is needed.
Declaration
public static readonly LongSerializer Instance
Field Value
| Type | Description |
|---|---|
| LongSerializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a signed 64-bit integer value from the reader via ReadLong().
Declaration
public override long Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at a long token. Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| long | The deserialized long value. |
Overrides
Write(long, IScyllaWriter, ISerializationContext)
Writes a signed 64-bit integer value to the output via WriteLong(long).
Declaration
public override void Write(long value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value | The long value to serialize. |
| IScyllaWriter | writer | The writer that receives the serialized token. Never |
| ISerializationContext | context | The active serialization context. Never |