コード例 #1
0
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		protected RandomAccessFileAdapter(string path, bool lockFile, long initialLength, 
			bool readOnly)
		{
			bool ok = false;
			try
			{
				_path = new Sharpen.IO.File(path).GetCanonicalPath();
				_delegate = RandomAccessFileFactory.NewRandomAccessFile(_path, readOnly, lockFile
					);
				if (initialLength > 0)
				{
					_delegate.Seek(initialLength - 1);
					_delegate.Write(new byte[] { 0 });
				}
				ok = true;
			}
			catch (IOException e)
			{
				throw new Db4oIOException(e);
			}
			finally
			{
				if (!ok)
				{
					Close();
				}
			}
		}
コード例 #2
0
		/// <exception cref="System.IO.IOException"></exception>
		public virtual void Write(string path, RandomAccessFile raf, bool writeTrash)
		{
			if (_offset == 0)
			{
				writeTrash = false;
			}
			raf.Seek(_offset);
			raf.Write(BytesToWrite(_data, writeTrash), 0, _length);
			Write(FileBasedTransactionLogHandler.LockFileName(path), _lockFileData, writeTrash
				);
			Write(FileBasedTransactionLogHandler.LogFileName(path), _logFileData, writeTrash);
		}