BTDB.KVDBLayer.OnDiskMemoryMappedFileCollection.File.RandomRead C# (CSharp) Méthode

RandomRead() public méthode

public RandomRead ( byte data, int offset, int size, ulong position, bool doNotCache ) : void
data byte
offset int
size int
position ulong
doNotCache bool
Résultat void
            public void RandomRead(byte[] data, int offset, int size, ulong position, bool doNotCache)
            {
                lock (_lock)
                {
                    if (size > 0 && position < _writer.Ofs)
                    {
                        MapContent();
                        var read = size;
                        if (_writer.Ofs - position < (ulong)read) read = (int)(_writer.Ofs - position);
                        fixed (byte* dst = data)
                        {
                            CopyMemory(dst + offset, _pointer + position, read);
                        }
                        size -= read;
                        offset += read;
                        position += (ulong)read;
                    }
                    if (size == 0) return;
                    if ((ulong)_writer.GetCurrentPosition() < position + (ulong)size)
                        throw new EndOfStreamException();
                    Array.Copy(_writer.GetBuffer(), (int)(position - _writer.Ofs), data, offset, size);
                }
            }