Class StreamExtensions
Provides extension methods for Stream that are mostly useful when implementing GraphBinary serializers.
Inherited Members
Namespace: Gremlin.Net.Structure.IO.GraphBinary
Assembly: Gremlin.Net.dll
Syntax
public static class StreamExtensions
Methods
ReadAsync(Stream, int, CancellationToken)
Asynchronously reads a byte[] from a Stream into a buffer.
Declaration
public static Task<byte[]> ReadAsync(this Stream stream, int count, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| int | count | The number of bytes to read. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<byte[]> | The read byte[]. |
ReadBoolAsync(Stream, CancellationToken)
Declaration
public static Task<bool> ReadBoolAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<bool> | The read bool. |
ReadByteAsync(Stream, CancellationToken)
Declaration
public static Task<byte> ReadByteAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<byte> | The read byte. |
ReadDoubleAsync(Stream, CancellationToken)
Declaration
public static Task<double> ReadDoubleAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<double> | The read double. |
ReadFloatAsync(Stream, CancellationToken)
Declaration
public static Task<float> ReadFloatAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<float> | The read float. |
ReadIntAsync(Stream, CancellationToken)
Declaration
public static Task<int> ReadIntAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<int> | The read int. |
ReadLongAsync(Stream, CancellationToken)
Declaration
public static Task<long> ReadLongAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<long> | The read long. |
ReadShortAsync(Stream, CancellationToken)
Declaration
public static Task<short> ReadShortAsync(this Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read from. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task<short> | The read short. |
WriteAsync(Stream, byte[], CancellationToken)
Asynchronously writes a byte[] to a Stream.
Declaration
public static Task WriteAsync(this Stream stream, byte[] value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to write the byte[] to. |
| byte[] | value | The byte[] to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteBoolAsync(Stream, bool, CancellationToken)
Declaration
public static Task WriteBoolAsync(this Stream stream, bool value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| bool | value | The bool to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteByteAsync(Stream, byte, CancellationToken)
Declaration
public static Task WriteByteAsync(this Stream stream, byte value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| byte | value | The byte to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteDoubleAsync(Stream, double, CancellationToken)
Declaration
public static Task WriteDoubleAsync(this Stream stream, double value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| double | value | The double to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteFloatAsync(Stream, float, CancellationToken)
Declaration
public static Task WriteFloatAsync(this Stream stream, float value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| float | value | The float to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteIntAsync(Stream, int, CancellationToken)
Declaration
public static Task WriteIntAsync(this Stream stream, int value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| int | value | The int to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteLongAsync(Stream, long, CancellationToken)
Declaration
public static Task WriteLongAsync(this Stream stream, long value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| long | value | The long to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
WriteShortAsync(Stream, short, CancellationToken)
Declaration
public static Task WriteShortAsync(this Stream stream, short value, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | |
| short | value | The short to write. |
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |