-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As extension-method per #61 (comment)
- Loading branch information
Showing
3 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
source/gfoidl.Base64/Extensions/ReadOnlySequenceExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Buffers; | ||
|
||
namespace gfoidl.Base64 | ||
{ | ||
public static class ReadOnlySequenceExtensions | ||
{ | ||
public static void Encode(this Base64? encoder, in ReadOnlySequence<byte> data, IBufferWriter<byte>? writer, out long consumed, out long written) | ||
{ | ||
if (data.IsEmpty) | ||
{ | ||
consumed = 0; | ||
written = 0; | ||
return; | ||
} | ||
|
||
if (encoder is null) | ||
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.encoder); | ||
|
||
if (writer is null) | ||
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.writer); | ||
|
||
throw new NotImplementedException(); | ||
} | ||
//--------------------------------------------------------------------- | ||
public static bool TryDecode(this Base64? encoder, in ReadOnlySequence<byte> base64, IBufferWriter<byte>? writer, out long consumed, out long written) | ||
{ | ||
if (base64.IsEmpty) | ||
{ | ||
consumed = 0; | ||
written = 0; | ||
return true; | ||
} | ||
|
||
if (encoder == null) | ||
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.encoder); | ||
|
||
if (writer is null) | ||
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.writer); | ||
|
||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters