| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using ZeroC.Slice; |
| | 4 | |
|
| | 5 | | namespace IceRpc.Internal; |
| | 6 | |
|
| | 7 | | /// <summary>Provides an extension method for <see cref="SliceDecoder" /> to check if the end of the decoder's |
| | 8 | | /// underlying buffer is reached.</summary> |
| | 9 | | internal static class SliceDecoderExtensions |
| | 10 | | { |
| | 11 | | /// <summary>Verifies the Slice decoder has reached the end of its underlying buffer.</summary> |
| | 12 | | /// <param name="decoder">The Slice decoder.</param> |
| | 13 | | internal static void CheckEndOfBuffer(this ref SliceDecoder decoder) |
| 22552 | 14 | | { |
| 22552 | 15 | | if (!decoder.End) |
| 6 | 16 | | { |
| 6 | 17 | | throw new InvalidDataException($"There are {decoder.Remaining} bytes remaining in the buffer."); |
| | 18 | | } |
| 22546 | 19 | | } |
| | 20 | | } |