Exemple #1
0
        public bool TryWrite(byte[] data, out long storeOffset)
        {
            lock (_writeLock)
            {
                if (!IsSpaceAvailable(data.Length))
                {
                    storeOffset = 0;
                    return(false);
                }

                storeOffset = _currentOffset;
                _writeStream.Write(data, 0, data.Length);
                _writeStream.Flush();
                _currentOffset += data.Length;
                UpdateOffset();
                return(true);
            }
        }