Beispiel #1
0
 /// <summary>
 /// Encodes stream of bytes into a Base16 text.
 /// </summary>
 /// <param name="input">Stream that provides bytes to be encoded.</param>
 /// <param name="output">Stream that the encoded text is written to.</param>
 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
 public async Task EncodeAsync(Stream input, TextWriter output)
 {
     await StreamHelper.EncodeAsync(input, output, (buffer, lastBlock) =>
                                    Encode(buffer.Span)).ConfigureAwait(false);
 }
Beispiel #2
0
 /// <summary>
 /// Encodes stream of bytes into a Base16 text.
 /// </summary>
 /// <param name="input">Stream that provides bytes to be encoded.</param>
 /// <param name="output">Stream that the encoded text is written to.</param>
 public void Encode(Stream input, TextWriter output)
 {
     StreamHelper.Encode(input, output, (buffer, lastBlock) => Encode(buffer.Span));
 }
Beispiel #3
0
 /// <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>
 public void Decode(TextReader input, Stream output)
 {
     StreamHelper.Decode(input, output, buffer => this.Decode(buffer.Span).ToArray());
 }
Beispiel #4
0
 /// <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);
 }
Beispiel #5
0
 /// <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);
 }
Beispiel #6
0
 /// <summary>
 /// Decode a text reader into a stream.
 /// </summary>
 /// <param name="input">Input reader.</param>
 /// <param name="output">Output stream.</param>
 public void Decode(TextReader input, Stream output)
 {
     StreamHelper.Decode(input, output, (text) => Decode(text.Span).ToArray(), decodeBufferSize);
 }