Base64Url.DecodeFromChars Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DecodeFromChars(ReadOnlySpan<Char>) |
Decodes the span of unicode ASCII chars represented as Base64Url into binary data. |
DecodeFromChars(ReadOnlySpan<Char>, Span<Byte>) |
Decodes the span of unicode ASCII chars represented as Base64Url into binary data. |
DecodeFromChars(ReadOnlySpan<Char>, Span<Byte>, Int32, Int32, Boolean) |
Decodes the span of unicode ASCII chars represented as Base64Url into binary data. |
DecodeFromChars(ReadOnlySpan<Char>)
Decodes the span of unicode ASCII chars represented as Base64Url into binary data.
public:
static cli::array <System::Byte> ^ DecodeFromChars(ReadOnlySpan<char> source);
public static byte[] DecodeFromChars (ReadOnlySpan<char> source);
static member DecodeFromChars : ReadOnlySpan<char> -> byte[]
Public Shared Function DecodeFromChars (source As ReadOnlySpan(Of Char)) As Byte()
Parameters
- source
- ReadOnlySpan<Char>
The input span which contains ASCII chars in Base64Url that needs to be decoded.
Returns
A byte array which contains the result of the decoding operation.
Exceptions
source
contains a invalid Base64Url character,
more than two padding characters, or a non white space character among the padding characters.
Applies to
DecodeFromChars(ReadOnlySpan<Char>, Span<Byte>)
Decodes the span of unicode ASCII chars represented as Base64Url into binary data.
public:
static int DecodeFromChars(ReadOnlySpan<char> source, Span<System::Byte> destination);
public static int DecodeFromChars (ReadOnlySpan<char> source, Span<byte> destination);
static member DecodeFromChars : ReadOnlySpan<char> * Span<byte> -> int
Public Shared Function DecodeFromChars (source As ReadOnlySpan(Of Char), destination As Span(Of Byte)) As Integer
Parameters
- source
- ReadOnlySpan<Char>
The input span which contains ASCII chars in Base64Url that needs to be decoded.
The output span which contains the result of the operation, i.e. the decoded binary data.
Returns
The number of bytes written into the output span. This can be used to slice the output for subsequent calls, if necessary.
Exceptions
The buffer in destination
is too small to hold the encoded output.
source
contains a invalid Base64Url character,
more than two padding characters, or a non white space character among the padding characters.
Applies to
DecodeFromChars(ReadOnlySpan<Char>, Span<Byte>, Int32, Int32, Boolean)
Decodes the span of unicode ASCII chars represented as Base64Url into binary data.
public static System.Buffers.OperationStatus DecodeFromChars (ReadOnlySpan<char> source, Span<byte> destination, out int charsConsumed, out int bytesWritten, bool isFinalBlock = true);
static member DecodeFromChars : ReadOnlySpan<char> * Span<byte> * int * int * bool -> System.Buffers.OperationStatus
Public Shared Function DecodeFromChars (source As ReadOnlySpan(Of Char), destination As Span(Of Byte), ByRef charsConsumed As Integer, ByRef bytesWritten As Integer, Optional isFinalBlock As Boolean = true) As OperationStatus
Parameters
- source
- ReadOnlySpan<Char>
The input span which contains unicode ASCII chars in Base64Url that needs to be decoded.
The output span which contains the result of the operation, i.e. the decoded binary data.
- charsConsumed
- Int32
When this method returns, contains the number of input chars consumed during the operation. This can be used to slice the input for subsequent calls, if necessary. This parameter is treated as uninitialized.
- bytesWritten
- Int32
When this method returns, contains the number of bytes written into the output span. This can be used to slice the output for subsequent calls, if necessary. This parameter is treated as uninitialized.
- isFinalBlock
- Boolean
true
when the input span contains the entirety of data to encode; false
when more data may follow,
such as when calling in a loop. Calls with false
should be followed up with another call where this parameter is true
call. The default is true
.
Returns
One of the enumeration values that indicates the success or failure of the operation.
Remarks
As padding is optional for Base64Url the source
length not required to be a multiple of 4 even if isFinalBlock
is true
.
If the source
length is not a multiple of 4 and isFinalBlock
is true
the remainders decoded accordingly:
- Remainder of 3 chars - decoded into 2 bytes data, decoding succeeds.
- Remainder of 2 chars - decoded into 1 byte data. decoding succeeds.
- Remainder of 1 char - will cause OperationStatus.InvalidData result.