Lucene.Net.Store.Azure.AzureDirectory.CreateCachedOutputAsStream C# (CSharp) Method

CreateCachedOutputAsStream() public method

public CreateCachedOutputAsStream ( string name ) : StreamOutput
name string
return StreamOutput
        public StreamOutput CreateCachedOutputAsStream(string name)
        {
            return new StreamOutput(CacheDirectory.CreateOutput(name));
        }

Usage Example

        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.CreateCachedOutputAsStream(fileName))
                    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::CreateCachedOutputAsStream