/// <summary>for internal processing only.</summary> /// <remarks>for internal processing only.</remarks> public override bool Exists(string path) { Db4objects.Db4o.IO.MemoryIoAdapter mia = (Db4objects.Db4o.IO.MemoryIoAdapter)_memoryFiles .Get(path); if (mia == null) { return(false); } return(mia._length > 0); }
/// <summary>returns the content bytes for a database with the given name.</summary> /// <remarks>returns the content bytes for a database with the given name.</remarks> /// <param name="name">the name to be use for #openFile() or #openServer() calls</param> /// <returns>the content bytes</returns> public virtual byte[] Get(string name) { Db4objects.Db4o.IO.MemoryIoAdapter mia = (Db4objects.Db4o.IO.MemoryIoAdapter)_memoryFiles .Get(name); if (mia == null) { return(null); } return(mia._bytes); }
/// <summary>for internal processing only.</summary> /// <remarks>for internal processing only.</remarks> /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception> public override IoAdapter Open(string path, bool lockFile, long initialLength, bool readOnly) { Db4objects.Db4o.IO.MemoryIoAdapter mia = (Db4objects.Db4o.IO.MemoryIoAdapter)_memoryFiles .Get(path); if (mia == null) { mia = new Db4objects.Db4o.IO.MemoryIoAdapter(this, (int)initialLength); _memoryFiles.Put(path, mia); } return(mia); }
public virtual void TestGrowth() { MemoryIoAdapter factory = new MemoryIoAdapter(); factory.GrowBy(GrowBy); IoAdapter io = factory.Open(Url, false, 0, false); AssertLength(factory, 0); WriteBytes(io, GrowBy - 1); AssertLength(factory, GrowBy); WriteBytes(io, GrowBy - 1); AssertLength(factory, GrowBy * 2); WriteBytes(io, GrowBy * 2); AssertLength(factory, GrowBy * 4 - 2); }
/// <summary>for internal processing only.</summary> /// <remarks>for internal processing only.</remarks> /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception> public override IoAdapter Open(string path, bool lockFile, long initialLength, bool readOnly) { Db4objects.Db4o.IO.MemoryIoAdapter mia = (Db4objects.Db4o.IO.MemoryIoAdapter)_memoryFiles .Get(path); if (mia == null) { mia = new Db4objects.Db4o.IO.MemoryIoAdapter(this, (int)initialLength); _memoryFiles.Put(path, mia); } return mia; }
private void AssertLength(MemoryIoAdapter factory, int expected) { Assert.AreEqual(expected, factory.Get(Url).Length); }
private MemoryIoAdapter(Db4objects.Db4o.IO.MemoryIoAdapter adapter, int initialLength ) : this(adapter, new byte[initialLength]) { }
private MemoryIoAdapter(Db4objects.Db4o.IO.MemoryIoAdapter adapter, byte[] bytes) { _bytes = bytes; _length = bytes.Length; _growBy = adapter._growBy; }
private MemoryIoAdapter(MemoryIoAdapter adapter, int initialLength ) : this(adapter, new byte[initialLength]) { }
private MemoryIoAdapter(MemoryIoAdapter adapter, byte[] bytes) { _bytes = bytes; _length = bytes.Length; _growBy = adapter._growBy; }