Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ContentStreamResponse.cs
1using System;
3
4namespace Waher.Content
5{
9 public class ContentStreamResponse : IDisposable
10 {
17 {
18 this.ContentType = ContentType;
19 this.Encoded = Encoded;
20 this.HasError = false;
21 this.Error = null;
22 }
23
28 public ContentStreamResponse(Exception Error)
29 {
30 this.ContentType = null;
31 this.Encoded = null;
32 this.HasError = true;
33 this.Error = Error;
34 }
35
39 public string ContentType { get; }
40
44 public TemporaryStream Encoded { get; private set; }
45
49 public bool HasError { get; }
50
54 public Exception Error { get; }
55
59 public void Dispose()
60 {
61 this.Encoded?.Dispose();
62 this.Encoded = null;
63 }
64
68 public void AssertOk()
69 {
70 if (this.HasError)
71 throw this.Error;
72 }
73 }
74}
Contains information about a stream response to a content request.
ContentStreamResponse(Exception Error)
Contains information about an error stream response to a content request.
string ContentType
Internet Content-Type of encoded object.
TemporaryStream Encoded
Encoded object.
void AssertOk()
Asserts response is OK.
ContentStreamResponse(string ContentType, TemporaryStream Encoded)
Contains information about a success stream response to a content request.
Manages a temporary stream. Contents is kept in-memory, if below a memory threshold,...
override void Dispose(bool disposing)
Releases the unmanaged resources used by the System.IO.Stream and optionally releases the managed res...