/// <summary> /// Decode Base16 text through streams for generic use. Stream based variant tries to consume /// as little memory as possible, and relies of .NET's own underlying buffering mechanisms, /// contrary to their buffer-based versions. /// </summary> /// <param name="input">Stream that the encoded bytes would be read from.</param> /// <param name="output">Stream where decoded bytes will be written to.</param> /// <returns>Task that represents the async operation.</returns> public async Task DecodeAsync(TextReader input, Stream output) { await StreamHelper.DecodeAsync(input, output, buffer => this.Decode(buffer.Span).ToArray()) .ConfigureAwait(false); }
/// <summary> /// Decode a text reader into a stream. /// </summary> /// <param name="input">Input reader.</param> /// <param name="output">Output stream.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public async Task DecodeAsync(TextReader input, Stream output) { await StreamHelper.DecodeAsync(input, output, (text) => Decode(text.Span).ToArray(), decodeBufferSize) .ConfigureAwait(false); }