ContentEntity Class
Represents MIME entity with single body.
public sealed class ContentEntity : Entity
Public NotInheritable Class ContentEntity
Inherits Entity
- Inheritance:
- System.ObjectContentEntity
Constructors
ContentEntity(MediaType, Byte[], TransferEncodingType, Encoding)
Initializes a new instance of the ContentEntity class with specified content type, raw content, transfer encoding and charset.
public ContentEntity(MediaType contentType, byte[] content, TransferEncodingType encoding, Encoding charset)
Public Sub New(contentType As MediaType, content As Byte(), encoding As TransferEncodingType, charset As Encoding)
Parameters
contentType
- MediaType
Content-Type header value.
content
- System.Byte[]
The content. Can be null.
encoding
- TransferEncodingType
The content encoding.
charset
- System.Text.Encoding
The content charset. Can be null.
Exceptions
- System.ArgumentException
Content type top level type is multipart.
Content size exceeds limitation.
ContentEntity(MediaType, Stream, TransferEncodingType, Encoding)
Initializes a new instance of the ContentEntity class with specified content type, raw content, transfer encoding and charset.
public ContentEntity(MediaType contentType, Stream content, TransferEncodingType encoding, Encoding charset)
Public Sub New(contentType As MediaType, content As Stream, encoding As TransferEncodingType, charset As Encoding)
Parameters
contentType
- MediaType
Content-Type header value.
content
- System.IO.Stream
The content.
encoding
- TransferEncodingType
The content encoding.
charset
- System.Text.Encoding
The content charset. Can be null.
Exceptions
- System.ArgumentException
Content type top level type is multipart.
Content size exceeds limitation.
Properties
Charset
Gets or sets the content charset.
Property Value
- System.Text.Encoding
The content charset.
Remarks
Setting content charset value will re-encode the content. To avoid that, modify the Content-Type header directly.
Content
Gets the content.
Property Value
- System.Byte[]
The content.
Disposition
Gets or sets the content disposition.
Property Value
- System.String
The content disposition.
IsMultipart
Gets a value indicating whether this entity is multipart.
public override bool IsMultipart { get; }
Public Overrides ReadOnly Property IsMultipart As Boolean
Property Value
- System.Boolean
True
if this entity is multipart; otherwise, false
.
Overrides
TransferEncoding
Gets or sets the content transfer encoding.
public TransferEncodingType TransferEncoding { get; set; }
Public Property TransferEncoding As TransferEncodingType
Property Value
The content transfer encoding.
Remarks
Setting content transfer encoding value will re-encode the content. To avoid that, modify the Content-Transfer-Encoding header directly.
Methods
Clone()
Creates a copy of this ContentEntity instance.
Returns
The copy of this ContentEntity instance.
Overrides
DecodeContent()
Decodes the Content.
Returns
- System.Byte[]
A decoded content.
Remarks
The method decodes the raw content using specifed TransferEncoding.
Find(Func<Entity, Boolean>)
Checks if this ContentEntity instance or one of its children satisfies a condition.
public override Entity Find(Func<Entity, bool> predicate)
Public Overrides Function Find(predicate As Func(Of Entity, Boolean)) As Entity
Parameters
predicate
- System.Func<Entity, System.Boolean>
A function to test each element for a condition.
Returns
ContentEntity instance which satisfies a condition; otherwise, null.
Overrides
Inherited Properties
ContentType | Gets the Content-Type header value. (Inherited from Entity) |
Headers | Gets the Entity headers. (Inherited from Entity) |
Parent | Gets the Entity parent. (Inherited from Entity) |
Inherited Methods
Find(MediaType) | Checks if this Entity instance or one of its children matches the specified content type. (Inherited from Entity) |
Find(System.String) | Checks if this Entity instance or one of its children matches the specified top level media type. (Inherited from Entity) |