/// <inheritdoc /> public override byte[] Read([NotNull] IWireStreamReaderStrategy source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } //Must read size first before reverseing int size = SizeStrategy.Size(source); //Then reverse the stream with 1 time reverse/read semantics return(source.WithOneTimeReading() .WithByteReversal() .ReadBytes(size)); }
/// <inheritdoc /> public override async Task <byte[]> ReadAsync([NotNull] IWireStreamReaderStrategyAsync source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } //Must read size first before reverseing int size = await SizeStrategy.SizeAsync(source) .ConfigureAwait(false); return(await source.WithOneTimeReadingAsync() .WithByteReversalAsync() .ReadBytesAsync(size) .ConfigureAwait(false)); }