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