|
| AzureFile (string blobName, AzureVirtualPathProvider parentProvider) |
|
override System.IO.Stream | Open () |
| Attempts to download the blob into a MemoryStream instance and return it. Throws a FileNotFoundException if the blob doesn't exist. More...
|
|
|
string | VirtualPath [get] |
| The virtual path of the file (relative to the domain, like /app/folder/file.ext) More...
|
|
Definition at line 11 of file AzureFile.cs.
override System.IO.Stream ImageResizer.Plugins.AzureReader2.AzureFile.Open |
( |
| ) |
|
|
inline |
Attempts to download the blob into a MemoryStream instance and return it. Throws a FileNotFoundException if the blob doesn't exist.
- Returns
Implements ImageResizer.Plugins.IVirtualFile.
Definition at line 22 of file AzureFile.cs.
27 Uri blobUri =
new Uri(
string.Format(
"{0}/{1}", parent.CloudBlobClient.BaseUri.OriginalString.TrimEnd(
'/',
'\\'),
VirtualPath));
28 ICloudBlob cloudBlob = parent.CloudBlobClient.GetBlobReferenceFromServer(blobUri);
30 MemoryStream ms =
new MemoryStream(4096);
34 cloudBlob.DownloadToStream(ms);
36 catch (StorageException e) {
40 if (e.RequestInformation.ExtendedErrorInformation.ErrorCode ==
"BlobNotFound") {
41 throw new FileNotFoundException(
"Azure blob file not found", e);
43 else if (e.RequestInformation.ExtendedErrorInformation.ErrorCode ==
"ContainerNotFound")
45 throw new FileNotFoundException(
"Azure blob container not found", e);
52 ms.Seek(0, SeekOrigin.Begin);
string VirtualPath
The virtual path of the file (relative to the domain, like /app/folder/file.ext)
The documentation for this class was generated from the following file:
- C:/Users/nathanael/Documents/resizer/Plugins/AzureReader2/AzureFile.cs