using Lucene.Net.Store; Directory dir = FSDirectory.Open("/path/to/directory"); string fileName = "my_index_file.txt"; IndexOutput output = dir.CreateOutput(fileName);
using Lucene.Net.Store; using System.Text; Directory dir = FSDirectory.Open("/path/to/directory"); string fileName = "my_index_file.txt"; IndexOutput output = dir.CreateOutput(fileName); string data = "Hello, world!"; byte[] bytes = Encoding.UTF8.GetBytes(data); output.WriteBytes(bytes, bytes.Length); output.Flush(); output.Close();In this example, the output stream created in Example 1 is used to write a string of data to the file. The data is first encoded as UTF-8 bytes using the Encoding class. The WriteBytes method is then called to write the bytes to the output stream, which is then flushed and closed using the Flush and Close methods, respectively. Package library: Lucene.Net.Store