Commit 9f9f5fd7 authored by Ray Koopa's avatar Ray Koopa

Additional methods for BinaryStream.

parent f3f4b790
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace Syroot.BinaryData
{
......@@ -58,6 +60,51 @@ namespace Syroot.BinaryData
/// </summary>
public Stream BaseStream { get; }
/// <summary>
/// Gets a value indicating whether the end of the stream has been reached.
/// </summary>
public bool EndOfStream
=> BaseStream.IsEndOfStream();
// ---- Configuration ----
/// <summary>
/// Gets or sets the <see cref="ByteConverter"/> instance used to parse multibyte binary data with.
/// Setting this value to <c>null</c> will restore the default <see cref="ByteConverter.Big"/>.
/// </summary>
public ByteConverter ByteConverter
{
get => _byteConverter;
set => _byteConverter = value ?? ByteConverter.System;
}
/// <summary>
/// Gets or sets the encoding used for string related operations where no other encoding has been provided.
/// Setting this value to <c>null</c> will restore the default <see cref="Encoding.UTF8"/>.
/// </summary>
public Encoding Encoding
{
get => _encoding;
set => _encoding = value ?? Encoding.UTF8;
}
/// <summary>
/// Gets the <see cref="BinaryData.BooleanCoding"/> to use for <see cref="Boolean"/> values.
/// </summary>
public BooleanCoding BooleanCoding { get; set; }
/// <summary>
/// Gets the <see cref="BinaryData.DateTimeCoding"/> to use for <see cref="DateTime"/> values.
/// </summary>
public DateTimeCoding DateTimeCoding { get; set; }
/// <summary>
/// Gets the <see cref="BinaryData.StringCoding"/> to use for <see cref="String"/> values.
/// </summary>
public StringCoding StringCoding { get; set; }
// ---- Stream implementation ----
/// <summary>
/// Gets a value indicating whether the underlying stream supports reading.
/// </summary>
......@@ -76,12 +123,6 @@ namespace Syroot.BinaryData
public override bool CanWrite
=> BaseStream.CanWrite;
/// <summary>
/// Gets a value indicating whether the end of the stream has been reached.
/// </summary>
public bool EndOfStream
=> BaseStream.IsEndOfStream();
/// <summary>
/// Gets or sets the length in bytes of the stream in bytes.
/// </summary>
......@@ -98,44 +139,91 @@ namespace Syroot.BinaryData
set => BaseStream.Position = value;
}
// ---- Configuration ----
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
/// <summary>
/// Gets or sets the <see cref="ByteConverter"/> instance used to parse multibyte binary data with.
/// Setting this value to <c>null</c> will restore the default <see cref="ByteConverter.Big"/>.
/// Aligns the underlying stream to the given byte multiple.
/// </summary>
public ByteConverter ByteConverter
{
get => _byteConverter;
set => _byteConverter = value ?? ByteConverter.System;
}
/// <param name="alignment">The byte multiple to align to. If negative, the position is decreased to the
/// previous multiple rather than the next one.</param>
/// <param name="grow"><c>true</c> to enlarge the stream size to include the final position in case it is larger
/// than the current stream length.</param>
/// <returns>The new position within the current stream.</returns>
public long Align(long alignment, bool grow = false)
=> BaseStream.Align(alignment, grow);
/// <summary>
/// Gets or sets the encoding used for string related operations where no other encoding has been provided.
/// Setting this value to <c>null</c> will restore the default <see cref="Encoding.UTF8"/>.
/// Sets the position within the underlying stream relative to the current position. If the stream is
/// not seekable, it tries to simulates advancing the position by reading or writing 0-bytes.
/// </summary>
public Encoding Encoding
{
get => _encoding;
set => _encoding = value ?? Encoding.UTF8;
}
/// <param name="offset">A byte offset relative to the origin parameter.</param>
public void Move(long offset)
=> BaseStream.Move(offset);
/// <summary>
/// Gets the <see cref="BinaryData.BooleanCoding"/> to use for <see cref="Boolean"/> values.
/// Sets the position within the underlying stream relative to the current position.
/// </summary>
public BooleanCoding BooleanCoding { get; set; }
/// <param name="offset">A byte offset relative to the current position in the stream.</param>
/// <returns>The new position within the current stream.</returns>
public long Seek(long offset)
=> BaseStream.Seek(offset);
/// <summary>
/// Gets the <see cref="BinaryData.DateTimeCoding"/> to use for <see cref="DateTime"/> values.
/// Creates a <see cref="BinaryData.Seek"/> with the given parameters. As soon as the returned
/// <see cref="BinaryData.Seek"/> is disposed, the previous stream position will be restored.
/// </summary>
public DateTimeCoding DateTimeCoding { get; set; }
/// <param name="offset">A byte offset relative to the origin parameter.</param>
/// <param name="origin">A value of type <see cref="SeekOrigin"/> indicating the reference point used to obtain
/// the new position.</param>
/// <returns>The <see cref="BinaryData.Seek"/> to be disposed to undo the seek.</returns>
public Seek TemporarySeek(long offset = 0, SeekOrigin origin = SeekOrigin.Current)
=> BaseStream.TemporarySeek(offset, origin);
// ---- Read ----
/// <summary>
/// Gets the <see cref="BinaryData.StringCoding"/> to use for <see cref="String"/> values.
/// Returns <paramref name="count"/> instances of type <typeparamref name="T"/> continually read from the
/// underlying stream by calling the <paramref name="readCallback"/>.
/// </summary>
public StringCoding StringCoding { get; set; }
/// <typeparam name="T">The type of the instances to read.</typeparam>
/// <param name="count">The number of instances to read.</param>
/// <param name="readCallback">The read callback function invoked for each instance read.</param>
/// <returns>The array of read instances.</returns>
public T[] ReadMany<T>(int count, Func<T> readCallback)
=> BaseStream.ReadMany(count, readCallback);
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
/// <summary>
/// Returns <paramref name="count"/> instances of type <typeparamref name="T"/> continually read asynchronously
/// from the underlying stream by calling the <paramref name="readCallback"/>.
/// </summary>
/// <typeparam name="T">The type of the instances to read.</typeparam>
/// <param name="count">The number of instances to read.</param>
/// <param name="readCallback">The read callback function invoked for each instance read.</param>
/// <returns>The array of read instances.</returns>
public async Task<T[]> ReadManyAsync<T>(int count, Func<Task<T>> readCallback)
=> await BaseStream.ReadManyAsync(count, readCallback);
// ---- Write ----
/// <summary>
/// Writes the <paramref name="values"/> to the underlying stream through the <paramref name="writeCallback"/>
/// invoked for each value.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="writeCallback">The callback invoked to write each value.</param>
public void WriteMany<T>(IEnumerable<T> values, Action<T> writeCallback)
=> BaseStream.WriteMany(values, writeCallback);
/// <summary>
/// Writes the <paramref name="values"/> to the underlying stream asynchronously through the
/// <paramref name="writeCallback"/> invoked for each value.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="writeCallback">The callback invoked to write each value.</param>
public async Task WriteManyAsync<T>(IEnumerable<T> values, Func<T, Task> writeCallback)
=> await BaseStream.WriteManyAsync(values, writeCallback);
// ---- Stream implementation ----
/// <summary>
/// Clears all buffers for this stream and causes any buffered data to be written to the underlying stream.
......
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Syroot.BinaryData
{
public partial class BinaryStream
{
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
// ---- Read 1 7BitInt32 ----
/// <summary>
/// Returns a variable-length <see cref="Int32"/> instance read from the given underlying stream which
/// can require up to 5 bytes.
/// </summary>
/// <returns>The value read from the current stream.</returns>
public Int32 Read7BitInt32()
=> BaseStream.Read7BitInt32();
/// <summary>
/// Returns a variable-length <see cref="Int32"/> instance read asynchronously from the given
/// underlying stream which can require up to 5 bytes.
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The value read from the current stream.</returns>
public async Task<Int32> Read7BitInt32Async(
CancellationToken cancellationToken = default)
=> await BaseStream.Read7BitInt32Async(cancellationToken);
// ---- Read N 7BitInt32s ----
/// <summary>
/// Returns an array of variable-length <see cref="Int32"/> instances read from the underlying stream
/// which can require to 5 bytes each.
/// </summary>
/// <param name="count">The number of values to read.</param>
/// <returns>The array of values read from the current stream.</returns>
public Int32[] Read7BitInt32s(int count)
=> BaseStream.Read7BitInt32s(count);
/// <summary>
/// Returns an array of variable-length <see cref="Int32"/> instances read asynchronously from the
/// underlying stream which can require to 5 bytes each.
/// </summary>
/// <param name="count">The number of values to read.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The array of values read from the current stream.</returns>
public async Task<Int32[]> Read7BitInt32sAsync(int count,
CancellationToken cancellationToken = default)
=> await BaseStream.Read7BitInt32sAsync(count, cancellationToken);
// ---- Write 1 7BitInt32 ----
/// <summary>
/// Writes a variable-length <see cref="Int32"/> value to the underlying stream which can require up to
/// 5 bytes.
/// </summary>
/// <param name="value">The value to write.</param>
public void Write7BitInt32(Int32 value)
=> BaseStream.Write7BitInt32(value);
/// <summary>
/// Writes a variable-length <see cref="Int32"/> value asynchronously to the underlying stream which can
/// require up to 5 bytes.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task Write7BitInt32Async(Int32 value,
CancellationToken cancellationToken = default)
=> await BaseStream.Write7BitInt32Async(value, cancellationToken);
// ---- Write N 7BitInt32s ----
/// <summary>
/// Writes an enumerable of <see cref="Int32"/> values to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
public void Write7BitInt32s(IEnumerable<Int32> values)
=> BaseStream.Write7BitInt32s(values);
/// <summary>
/// Writes an enumerable of <see cref="Int32"/> values asynchronously to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task Write7BitInt32Async(IEnumerable<Int32> values,
CancellationToken cancellationToken = default)
=> await BaseStream.Write7BitInt32sAsync(values, cancellationToken);
}
}
......@@ -9,7 +9,7 @@ namespace Syroot.BinaryData
{
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
// ---- Read ----
// ---- Read 1 Boolean ----
/// <summary>
/// Returns a <see cref="Boolean"/> instance read from the underlying stream.
......@@ -23,9 +23,12 @@ namespace Syroot.BinaryData
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The value read from the current stream.</returns>
public async Task<Boolean> ReadBooleanAsync(CancellationToken cancellationToken = default)
public async Task<Boolean> ReadBooleanAsync(
CancellationToken cancellationToken = default)
=> await BaseStream.ReadBooleanAsync(BooleanCoding, cancellationToken);
// ---- Read N Booleans ----
/// <summary>
/// Returns an array of <see cref="Boolean"/> instances read from the underlying stream.
/// </summary>
......@@ -44,7 +47,7 @@ namespace Syroot.BinaryData
CancellationToken cancellationToken = default)
=> await BaseStream.ReadBooleansAsync(count, BooleanCoding, cancellationToken);
// ---- Write ----
// ---- Write 1 Boolean ----
/// <summary>
/// Writes a <see cref="Boolean"/> value to the underlying stream.
......@@ -58,7 +61,8 @@ namespace Syroot.BinaryData
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(Boolean value, CancellationToken cancellationToken = default)
public async Task WriteAsync(Boolean value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, BooleanCoding, ByteConverter, cancellationToken);
/// <summary>
......@@ -77,6 +81,8 @@ namespace Syroot.BinaryData
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, BooleanCoding, ByteConverter, cancellationToken);
// ---- Write N Booleans ----
/// <summary>
/// Writes an enumerable of <see cref="Boolean"/> values to the underlying stream.
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Syroot.BinaryData
{
public partial class BinaryStream
{
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
// ---- Read 1 Byte ----
/// <summary>
/// Returns a <see cref="Byte"/> instance read from the underlying stream.
/// </summary>
/// <returns>The value read from the current stream.</returns>
public Byte Read1Byte()
=> BaseStream.Read1Byte();
/// <summary>
/// Returns a <see cref="Byte"/> instance read asynchronously from the underlying stream.
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The value read from the current stream.</returns>
public async Task<byte> Read1ByteAsync(
CancellationToken cancellationToken = default)
=> await BaseStream.Read1ByteAsync(cancellationToken);
// ---- Read N Bytes ----
/// <summary>
/// Returns an array of <see cref="Byte"/> instances read from the underlying stream.
/// </summary>
/// <param name="count">The number of values to read.</param>
/// <returns>The array of values read from the current stream.</returns>
public Byte[] ReadBytes(int count)
=> BaseStream.ReadBytes(count);
/// <summary>
/// Returns an array of <see cref="Byte"/> instances read asynchronously from the underlying stream.
/// </summary>
/// <param name="count">The number of values to read.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The array of values read from the current stream.</returns>
public async Task<Byte[]> ReadBytesAsync(int count,
CancellationToken cancellationToken = default)
=> await BaseStream.ReadBytesAsync(count, cancellationToken);
// ---- Write 1 Byte ----
/// <summary>
/// Writes a <see cref="Byte"/> value to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
public void Write(Byte value)
=> BaseStream.WriteByte(value); // use System.IO.Stream implementation directly.
/// <summary>
/// Writes a <see cref="Byte"/> value asynchronously to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(Byte value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, cancellationToken);
// public void WriteByte(Byte value) already implemented by System.IO.Stream
/// <summary>
/// Writes a <see cref="Byte"/> value asynchronously to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteByteAsync(Byte value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, cancellationToken);
// ---- Write N Bytes ----
/// <summary>
/// Writes an enumerable of <see cref="Byte"/> values to the underlying stream. This method writes bytes
/// one-by-one.
/// </summary>
/// <param name="values">The values to write.</param>
public void Write(IEnumerable<Byte> values)
=> BaseStream.Write(values);
/// <summary>
/// Writes an enumerable of <see cref="Byte"/> values to the underlying stream. This method writes bytes
/// one-by-one.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(IEnumerable<Byte> values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, cancellationToken);
/// <summary>
/// Writes an enumerable of <see cref="Byte"/> values to the underlying stream. This method writes bytes
/// one-by-one.
/// </summary>
/// <param name="values">The values to write.</param>
public void WriteBytes(IEnumerable<Byte> values)
=> BaseStream.Write(values);
/// <summary>
/// Writes an enumerable of <see cref="Byte"/> values to the underlying stream. This method writes bytes
/// one-by-one.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteBytesAsync(IEnumerable<Byte> values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, cancellationToken);
// ---- Write N Bytes (1 call) ----
/// <summary>
/// Writes an array of <see cref="Byte"/> values to the underlying stream. This method writes all bytes
/// in one call.
/// </summary>
/// <param name="values">The values to write.</param>
public void Write(Byte[] values)
=> BaseStream.Write(values);
/// <summary>
/// Writes an array of <see cref="Byte"/> values to the underlying stream. This method writes all bytes
/// in one call.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(Byte[] values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, cancellationToken);
/// <summary>
/// Writes an array of <see cref="Byte"/> values to the underlying stream. This method writes all bytes
/// in one call.
/// </summary>
/// <param name="values">The values to write.</param>
public void WriteBytes(Byte[] values)
=> BaseStream.Write(values);
/// <summary>
/// Writes an array of <see cref="Byte"/> values to the underlying stream. This method writes all bytes
/// in one call.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteBytesAsync(Byte[] values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, cancellationToken);
}
}
......@@ -9,7 +9,7 @@ namespace Syroot.BinaryData
{
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
// --- Read ----
// --- Read 1 DateTime ----
/// <summary>
/// Returns a <see cref="DateTime"/> instance read from the underlying stream.
......@@ -23,9 +23,12 @@ namespace Syroot.BinaryData
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The value read from the current stream.</returns>
public async Task<DateTime> ReadDateTimeAsync(CancellationToken cancellationToken = default)
public async Task<DateTime> ReadDateTimeAsync(
CancellationToken cancellationToken = default)
=> await BaseStream.ReadDateTimeAsync(DateTimeCoding, ByteConverter, cancellationToken);
// --- Read N DateTimes ----
/// <summary>
/// Returns an array of <see cref="DateTime"/> instances read from the underlying stream.
/// </summary>
......@@ -44,7 +47,7 @@ namespace Syroot.BinaryData
CancellationToken cancellationToken = default)
=> await BaseStream.ReadDateTimesAsync(count, DateTimeCoding, ByteConverter, cancellationToken);
// ---- Write ----
// ---- Write 1 DateTime ----
/// <summary>
/// Writes a <see cref="DateTime"/> value to the underlying stream.
......@@ -61,38 +64,41 @@ namespace Syroot.BinaryData
=> BaseStream.Write(values, DateTimeCoding, ByteConverter);
/// <summary>
/// Writes a <see cref="DateTime"/> value asynchronously to the underlying stream.
/// Writes a <see cref="DateTime"/> value to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(DateTime value, CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, DateTimeCoding, ByteConverter, cancellationToken);
public void WriteDateTime(DateTime value)
=> BaseStream.Write(value, DateTimeCoding, ByteConverter);
/// <summary>
/// Writes an enumerable of <see cref="DateTime"/> asynchronously values to the underlying stream.
/// Writes a <see cref="DateTime"/> value asynchronously to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(IEnumerable<DateTime> values,
public async Task WriteDateTimeAsync(DateTime value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, DateTimeCoding, ByteConverter, cancellationToken);
=> await BaseStream.WriteAsync(value, DateTimeCoding, ByteConverter, cancellationToken);
/// <summary>
/// Writes a <see cref="DateTime"/> value to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
public void WriteDateTime(DateTime value)
=> BaseStream.Write(value, DateTimeCoding, ByteConverter);
// ---- Write N DateTimes ----
/// <summary>
/// Writes a <see cref="DateTime"/> value asynchronously to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteDateTimeAsync(DateTime value,
public async Task WriteAsync(DateTime value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, DateTimeCoding, ByteConverter, cancellationToken);
/// <summary>
/// Writes an enumerable of <see cref="DateTime"/> asynchronously values to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(IEnumerable<DateTime> values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, DateTimeCoding, ByteConverter, cancellationToken);
/// <summary>
/// Writes an enumerable of <see cref="DateTime"/> values to the underlying stream.
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Syroot.BinaryData
{
public partial class BinaryStream
{
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
// ---- Read 1 Decimal ----
/// <summary>
/// Returns a <see cref="Decimal"/> instance read from the underlying stream.
/// </summary>
/// <returns>The value read from the current stream.</returns>
public Decimal ReadDecimal()
=> BaseStream.ReadDecimal();
/// <summary>
/// Returns a <see cref="Decimal"/> instance read asynchronously from the underlying stream.
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The value read from the current stream.</returns>
public async Task<Decimal> ReadDecimalAsync(
CancellationToken cancellationToken = default)
=> await BaseStream.ReadDecimalAsync(cancellationToken);
// ---- Read N Decimals ----
/// <summary>
/// Returns an array of <see cref="Decimal"/> instances read from the underlying stream.
/// </summary>
/// <param name="count">The number of values to read.</param>
/// <returns>The array of values read from the current stream.</returns>
public Decimal[] ReadDecimals(int count)
=> BaseStream.ReadDecimals(count);
/// <summary>
/// Returns an array of <see cref="Decimal"/> instances read asynchronously from the underlying stream.
/// </summary>
/// <param name="count">The number of values to read.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The array of values read from the current stream.</returns>
public async Task<Decimal[]> ReadDecimalsAsync(int count,
CancellationToken cancellationToken = default)
=> await BaseStream.ReadDecimalsAsync(count, cancellationToken);
// ---- Write 1 Decimal ----
/// <summary>
/// Writes a <see cref="Decimal"/> value to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
public void Write(Decimal value)
=> BaseStream.Write(value);
/// <summary>
/// Writes a <see cref="Decimal"/> value asynchronously to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(Decimal value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, cancellationToken);
/// <summary>
/// Writes a <see cref="Decimal"/> value to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
public void WriteDecimal(Decimal value)
=> BaseStream.Write(value);
/// <summary>
/// Writes a <see cref="Decimal"/> value asynchronously to the underlying stream.
/// </summary>
/// <param name="value">The value to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteDecimalAsync(Decimal value,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(value, cancellationToken);
// ---- Write N Decimals ----
/// <summary>
/// Writes an enumerable of <see cref="Decimal"/> values to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
public void Write(IEnumerable<Decimal> values)
=> BaseStream.Write(values);
/// <summary>
/// Writes an enumerable of <see cref="Decimal"/> values asynchronously to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteAsync(IEnumerable<Decimal> values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, cancellationToken);
/// <summary>
/// Writes an enumerable of <see cref="Decimal"/> values to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
public void WriteDecimals(IEnumerable<Decimal> values)
=> BaseStream.WriteDecimals(values);
/// <summary>
/// Writes an enumerable of <see cref="Decimal"/> values asynchronously to the underlying stream.
/// </summary>
/// <param name="values">The values to write.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
public async Task WriteDecimalsAsync(IEnumerable<Decimal> values,
CancellationToken cancellationToken = default)
=> await BaseStream.WriteAsync(values, cancellationToken);
}
}