VirtoCommerce.Platform.Data.Asset.AzureBlobProvider.OpenReadOnly C# (CSharp) Method

OpenReadOnly() public method

public OpenReadOnly ( string url ) : Stream
url string
return System.IO.Stream
        public System.IO.Stream OpenReadOnly(string url)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException("url");

            System.IO.Stream retVal = null;
            var uri = url.IsAbsoluteUrl() ? new Uri(url) : new Uri(_cloudBlobClient.BaseUri, url.TrimStart('/'));
            var cloudBlob = _cloudBlobClient.GetBlobReferenceFromServer(uri);
            if (cloudBlob.Exists())
            {
                var stream = new MemoryStream();
                cloudBlob.DownloadToStream(stream);
                if (stream.CanSeek)
                {
                    stream.Seek(0, SeekOrigin.Begin);
                }
                retVal = stream;
            }
            return retVal;
        }