Lucene.Net.Store.Azure.AzureDirectory.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 ) : IndexOutput
name System
return IndexOutput
        public override IndexOutput CreateOutput(System.String name)
        {
            var blob = _blobContainer.GetBlockBlobReference(_rootFolder + name);
            return new AzureIndexOutput(this, blob);
        }

Usage Example

Ejemplo n.º 1
0
        private void InflateStream(string fileName)
        {
            // then we will get it fresh into local deflatedName
            // StreamOutput deflatedStream = new StreamOutput(CacheDirectory.CreateOutput(deflatedName));
            using (var deflatedStream = new MemoryStream())
            {
                // get the deflated blob
                _blob.DownloadToStream(deflatedStream);

                Debug.WriteLine(string.Format("GET {0} RETREIVED {1} bytes", _name, deflatedStream.Length));

                // seek back to begininng
                deflatedStream.Seek(0, SeekOrigin.Begin);

                // open output file for uncompressed contents
                using (var fileStream = _azureDirectory.CreateOutput(fileName, IOContext.DEFAULT))
                    using (var decompressor = new DeflateStream(deflatedStream, CompressionMode.Decompress))
                    {
                        var bytes = new byte[65535];
                        var nRead = 0;
                        do
                        {
                            nRead = decompressor.Read(bytes, 0, 65535);
                            if (nRead > 0)
                            {
                                fileStream.Write(bytes, 0, nRead);
                            }
                        } while (nRead == 65535);
                    }
            }
        }
All Usage Examples Of Lucene.Net.Store.Azure.AzureDirectory::CreateOutput