Class ByteArraySerializer
Type serializer for byte arrays. Writes the entire array as a single opaque
bytes token, which is typically encoded as a Base64 string in JSON output. Returns
null when the token represents a null literal.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class ByteArraySerializer : TypeSerializerBase<byte[]>, ITypeSerializer<byte[]>, ITypeSerializer
Remarks
This serializer is intended for raw binary payloads (e.g., compressed data, image thumbnails, cryptographic buffers). For serializing arrays of numeric types that should be human-readable, prefer ArraySerializer<T> with Instance as the element serializer.
Use the shared Instance singleton rather than creating new instances;
ByteArraySerializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of ByteArraySerializer.
Prefer this over allocating a new instance wherever a ByteArraySerializer is needed.
Declaration
public static readonly ByteArraySerializer Instance
Field Value
| Type | Description |
|---|---|
| ByteArraySerializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a byte array from the reader via ReadBytes().
Declaration
public override byte[] Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at a bytes token. Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| byte[] | The deserialized byte array, or |
Overrides
Write(byte[], IScyllaWriter, ISerializationContext)
Writes a byte array to the output as a single bytes token via
WriteBytes(byte[]). Passing null is permitted; the writer
is expected to emit a null token.
Declaration
public override void Write(byte[] value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | value | The byte array to serialize, or |
| IScyllaWriter | writer | The writer that receives the serialized token. Never |
| ISerializationContext | context | The active serialization context. Never |