Lucene.Net.Store.MockRAMDirectory.CreateOutput C# (CSharp) Méthode

CreateOutput() public méthode

public CreateOutput ( String name ) : Lucene.Net.Store.IndexOutput
name String
Résultat Lucene.Net.Store.IndexOutput
        public override IndexOutput CreateOutput(String name)
        {
            lock (this)
            {
                if (crashed)
                    throw new System.IO.IOException("cannot createOutput after crash");
                Init();
                if (preventDoubleWrite && createdFiles.Contains(name) && !name.Equals("segments.gen"))
                    throw new System.IO.IOException("file \"" + name + "\" was already written to");
                if (noDeleteOpenFile && openFiles.ContainsKey(name))
                    throw new System.IO.IOException("MockRAMDirectory: file \"" + name + "\" is still open: cannot overwrite");
                RAMFile file = new RAMFile(this);
                if (crashed)
                    throw new System.IO.IOException("cannot createOutput after crash");
                unSyncedFiles.Add(name);
                createdFiles.Add(name);
                RAMFile existing = fileMap[name];
                // Enforce write once:
                if (existing != null && !name.Equals("segments.gen") && preventDoubleWrite)
                    throw new System.IO.IOException("file " + name + " already exists");
                else
                {
                    if (existing != null)
                    {
                        internalSizeInBytes -= existing.sizeInBytes;
                        existing.directory = null;
                    }

                    fileMap[name]=file;
                }

                return new MockRAMOutputStream(this, file, name);
            }
        }