Lucene.Net.Store.CompoundFileDirectory.ListAll C# (CSharp) Method

ListAll() public method

Returns an array of strings, one for each file in the directory.
public ListAll ( ) : string[]
return string[]
        public override string[] ListAll()
        {
            EnsureOpen();
            string[] res;
            if (Writer != null)
            {
                res = Writer.ListAll();
            }
            else
            {
                res = Entries.Keys.ToArray();
                // Add the segment name
                string seg = IndexFileNames.ParseSegmentName(FileName);
                for (int i = 0; i < res.Length; i++)
                {
                    res[i] = seg + res[i];
                }
            }
            return res;
        }

Usage Example

        public virtual void TestCompoundFileAppendTwice()
        {
            Directory newDir = new NRTCachingDirectory(NewDirectory(), 2.0, 25.0);
            CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", NewIOContext(Random()), true);
            CreateSequenceFile(newDir, "d1", (sbyte)0, 15);
            IndexOutput @out = csw.CreateOutput("d.xyz", NewIOContext(Random()));
            @out.WriteInt(0);
            @out.Dispose();
            Assert.AreEqual(1, csw.ListAll().Length);
            Assert.AreEqual("d.xyz", csw.ListAll()[0]);

            csw.Dispose();

            CompoundFileDirectory cfr = new CompoundFileDirectory(newDir, "d.cfs", NewIOContext(Random()), false);
            Assert.AreEqual(1, cfr.ListAll().Length);
            Assert.AreEqual("d.xyz", cfr.ListAll()[0]);
            cfr.Dispose();
            newDir.Dispose();
        }
All Usage Examples Of Lucene.Net.Store.CompoundFileDirectory::ListAll