12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System.Diagnostics;
- namespace SharpCompress.Compressors.Deflate64
- {
- internal sealed class DeflateInput
- {
- internal byte[] Buffer { get; set; }
- internal int Count { get; set; }
- internal int StartIndex { get; set; }
- internal void ConsumeBytes(int n)
- {
- Debug.Assert(n <= Count, "Should use more bytes than what we have in the buffer");
- StartIndex += n;
- Count -= n;
- Debug.Assert(StartIndex + Count <= Buffer.Length, "Input buffer is in invalid state!");
- }
- internal InputState DumpState() => new InputState(Count, StartIndex);
- internal void RestoreState(InputState state)
- {
- Count = state._count;
- StartIndex = state._startIndex;
- }
- internal struct InputState
- {
- internal readonly int _count;
- internal readonly int _startIndex;
- internal InputState(int count, int startIndex)
- {
- _count = count;
- _startIndex = startIndex;
- }
- }
- }
- }
|