Class CustomTypeSerializer
The interface to implement for serializers of custom types.
Implements
Inherited Members
Namespace: Gremlin.Net.Structure.IO.GraphBinary.Types
Assembly: Gremlin.Net.dll
Syntax
public abstract class CustomTypeSerializer : ITypeSerializer
Properties
DataType
Gets the DataType that supported by this serializer.
Declaration
public DataType DataType { get; }
Property Value
| Type | Description |
|---|---|
| DataType |
TypeName
Gets the custom type name.
Declaration
public abstract string TypeName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
ReadAsync(Stream, GraphBinaryReader, CancellationToken)
Reads the type information and value from the stream.
Declaration
public abstract Task<object?> ReadAsync(Stream stream, GraphBinaryReader reader, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The GraphBinary data to parse. |
| GraphBinaryReader | reader | A GraphBinaryReader that can be used to read nested values. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<object> | The read value. |
ReadNonNullableValueAsync(Stream, GraphBinaryReader, CancellationToken)
Reads the value from the stream (not the type information).
Declaration
public abstract Task<object> ReadNonNullableValueAsync(Stream stream, GraphBinaryReader reader, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The GraphBinary data to parse. |
| GraphBinaryReader | reader | A GraphBinaryReader that can be used to read nested values. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<object> | The read value. |
ReadNullableValueAsync(Stream, GraphBinaryReader, CancellationToken)
Reads the value from the stream (not the type information).
Declaration
public abstract Task<object?> ReadNullableValueAsync(Stream stream, GraphBinaryReader reader, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The GraphBinary data to parse. |
| GraphBinaryReader | reader | A GraphBinaryReader that can be used to read nested values. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<object> | The read value. |
WriteAsync(object, Stream, GraphBinaryWriter, CancellationToken)
Writes the type code, information and value to a stream.
Declaration
public abstract Task WriteAsync(object value, Stream stream, GraphBinaryWriter writer, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to write. |
| Stream | stream | The stream to write to. |
| GraphBinaryWriter | writer | A GraphBinaryWriter that can be used to write nested values. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous write operation. |
WriteNonNullableValueAsync(object, Stream, GraphBinaryWriter, CancellationToken)
Writes the non-nullable value to a stream, composed by the value flag and the sequence of bytes.
Declaration
public abstract Task WriteNonNullableValueAsync(object value, Stream stream, GraphBinaryWriter writer, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to write. |
| Stream | stream | The stream to write to. |
| GraphBinaryWriter | writer | A GraphBinaryWriter that can be used to write nested values. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous write operation. |
WriteNullableValueAsync(object, Stream, GraphBinaryWriter, CancellationToken)
Writes the nullable value to a stream, composed by the value flag and the sequence of bytes.
Declaration
public abstract Task WriteNullableValueAsync(object value, Stream stream, GraphBinaryWriter writer, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to write. |
| Stream | stream | The stream to write to. |
| GraphBinaryWriter | writer | A GraphBinaryWriter that can be used to write nested values. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous write operation. |