Class Blob
Represents a binary large object
Inherited Members
Namespace: EPiServer.Framework.Blobs
Assembly: EPiServer.Framework.dll
Version: 8.11.0Syntax
public class Blob
Constructors
Blob(Uri)
Initializes a new instance of the Blob class.
Declaration
protected Blob(Uri id)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | id | Resource reference |
Fields
BlobUriScheme
Declaration
public const string BlobUriScheme = "epi.fx.blob"
Field Value
Type | Description |
---|---|
System.String |
DefaultProvider
Declaration
public const string DefaultProvider = "default"
Field Value
Type | Description |
---|---|
System.String |
Properties
ID
The identifier of the blob
Declaration
public Uri ID { get; }
Property Value
Type | Description |
---|---|
System.Uri |
Remarks
Required identifier that must contain 1 to 100 characters that are unique and valid as file names, no whitespace allowed
Methods
GetContainerIdentifier(Guid)
Get a container identifier based on a guid and the default provider
Declaration
public static Uri GetContainerIdentifier(Guid container)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | container | The container ID |
Returns
Type | Description |
---|---|
System.Uri |
GetContainerIdentifier(String, Guid)
Get a container identifier based on a guid and a custom provider
Declaration
public static Uri GetContainerIdentifier(string provider, Guid container)
Parameters
Type | Name | Description |
---|---|---|
System.String | provider | The provider name |
System.Guid | container | The container ID |
Returns
Type | Description |
---|---|
System.Uri |
GetContainerIdentifier(Uri)
Extract the container identifier from an existing ID
Declaration
public static Uri GetContainerIdentifier(Uri id)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | id | The ID to either a container or an blob |
Returns
Type | Description |
---|---|
System.Uri | A new identifier only for the blob, no validation is done in this method. |
IsContainerIdentifier(Uri)
Determines whether the provided identifier is a valid container identifier, i.e. not a file identifier or an invalid identifier.
Declaration
public static bool IsContainerIdentifier(Uri id)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | id | The blob identifier. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsFileIdentifier(Uri)
Determines whether the provided identifier is a valid file identifier, i.e. not a container identifier or an invalid identifier.
Declaration
public static bool IsFileIdentifier(Uri id)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | id | The blob identifier. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsValidIdentifier(Uri)
Determines whether the specified identifier is a valid blob container or file identifier.
Declaration
public static bool IsValidIdentifier(Uri id)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | id | The blob identifier. |
Returns
Type | Description |
---|---|
System.Boolean |
|
NewBlobIdentifier(Uri, String)
Convert a GUID to an identifier that may end up on URL's
Declaration
public static Uri NewBlobIdentifier(Uri container, string extension)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | container | Container identifier |
System.String | extension | The extension for the file |
Returns
Type | Description |
---|---|
System.Uri | A string generated based on a GUID |
OpenRead()
Open blob for reading
Declaration
public virtual Stream OpenRead()
Returns
Type | Description |
---|---|
System.IO.Stream | A readable stream |
OpenWrite()
Open blob for writing
Declaration
public virtual Stream OpenWrite()
Returns
Type | Description |
---|---|
System.IO.Stream | A writable stream |
Remarks
This method normally means that the stream is cached in-memory or on disk before piped into storage, prefer to use the Write-method and pass in the stream instead.
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
ValidateIdentifier(Uri, Nullable<Boolean>)
Validates a blob identifier (Uri), optionally checking for existance of a file
Declaration
public static void ValidateIdentifier(Uri id, bool? testForFile)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | id | The blob identifier |
System.Nullable<System.Boolean> | testForFile | Check if the identifier has an file |
Remarks
A blob identifier is expected to be in the form of "epi.fx.blob://[container]/[filename]"
Write(Stream)
Write stream directly to blob (prefered method for writing)
Declaration
public virtual void Write(Stream data)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | data | The stream |
Remarks
The stream must be set to the correct position before calling this method