Lucene.Net.Store.RAMDirectory.CreateOutput C# (CSharp) Method

CreateOutput() public method

Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
public CreateOutput ( System name ) : Lucene.Net.Store.IndexOutput
name System
return Lucene.Net.Store.IndexOutput
		public override IndexOutput CreateOutput(System.String name)
		{
			EnsureOpen();
			RAMFile file = new RAMFile(this);
			lock (this)
			{
				RAMFile existing = fileMap[name];
				if (existing != null)
				{
					internalSizeInBytes -= existing.sizeInBytes;
					existing.directory = null;
				}
				fileMap[name] = file;
			}
			return new RAMOutputStream(file);
		}
		

Usage Example

コード例 #1
0
ファイル: TestDirectory.cs プロジェクト: stgwilli/ravendb
        public virtual void  TestDetectClose()
        {
            Directory dir = new RAMDirectory();

            dir.Close();
            try
            {
                dir.CreateOutput("test");
                Assert.Fail("did not hit expected exception");
            }
            catch (AlreadyClosedException ace)
            {
            }

            dir = FSDirectory.Open(new System.IO.FileInfo(SupportClass.AppSettings.Get("tempDir", System.IO.Path.GetTempPath())));
            dir.Close();
            try
            {
                dir.CreateOutput("test");
                Assert.Fail("did not hit expected exception");
            }
            catch (AlreadyClosedException ace)
            {
            }
        }
All Usage Examples Of Lucene.Net.Store.RAMDirectory::CreateOutput