// private methods
        private NativeBufferInfo CreateNativeBuffer(PinnedBufferWalker pinnedBufferWalker, ulong size)
        {
            var nativeBuffer = new NativeBufferInfo();

            nativeBuffer.DataPointer = pinnedBufferWalker?.IntPtr ?? IntPtr.Zero;
            nativeBuffer.Size        = size;
            nativeBuffer.Position    = 0;
            return(nativeBuffer);
        }
        public OperationContext InitializeOperationContext(
            BufferInfo compressedBufferInfo,
            BufferInfo uncompressedBufferInfo = null)
        {
            var compressedPinnedBufferWalker = new PinnedBufferWalker(compressedBufferInfo.Bytes, compressedBufferInfo.Offset);
            PinnedBufferWalker uncompressedPinnedBufferWalker = null;

            if (uncompressedBufferInfo != null)
            {
                uncompressedPinnedBufferWalker = new PinnedBufferWalker(uncompressedBufferInfo.Bytes, uncompressedBufferInfo.Offset);
            }

            return(new OperationContext(uncompressedPinnedBufferWalker, compressedPinnedBufferWalker));
        }
 public OperationContext(PinnedBufferWalker uncompressedPinnedBufferWalker, PinnedBufferWalker compressedPinnedBufferWalker)
 {
     _compressedPinnedBufferWalker   = Ensure.IsNotNull(compressedPinnedBufferWalker, nameof(compressedPinnedBufferWalker));
     _uncompressedPinnedBufferWalker = uncompressedPinnedBufferWalker; // can be null
 }