Improve this Doc View Source

Class ProgressStreamContent

The ProgressStreamContent makes it possible to track the progress of a http-post for a stream

Inheritance
System.Object
System.Net.Http.HttpContent
ProgressStreamContent
Namespace:Dapplo.HttpExtensions.Support
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class ProgressStreamContent : HttpContent, IDisposable

Constructors

| Improve this Doc View Source

ProgressStreamContent(Stream, IProgress<Single>, Int32)

Create a StreamContent which supports progress reporting

Declaration
public ProgressStreamContent(Stream content, IProgress<float> progressHandler = null, int bufferSize = 4096)
Parameters
Type Name Description
System.IO.Stream content

The stream for uploading

System.IProgress<System.Single> progressHandler

IProgress with float

System.Int32 bufferSize

Size of the upload buffer, 4Kb is default

Properties

| Improve this Doc View Source

ProgressHandler

Specify the IProgress, which will be informed of progress

Declaration
public IProgress<float> ProgressHandler { get; set; }
Returns
Type Description
System.IProgress<System.Single>
| Improve this Doc View Source

State

the current upload state

Declaration
public ProgressStreamContent.UploadStates State { get; }
Returns
Type Description
ProgressStreamContent.UploadStates
| Improve this Doc View Source

UploadedBytes

See the amount of bytes that were uploaded

Declaration
public long UploadedBytes { get; }
Returns
Type Description
System.Int64

Methods

| Improve this Doc View Source

Dispose(Boolean)

Dispose

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing
| Improve this Doc View Source

SerializeToStreamAsync(Stream, TransportContext)

This actually writes (serializes) the content-stream to the remote

Declaration
protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)
Parameters
Type Name Description
System.IO.Stream stream

Stream to write to

System.Net.TransportContext context
Returns
Type Description
System.Threading.Tasks.Task

Task

| Improve this Doc View Source

TryComputeLength(out Int64)

Return the length of the stream

Declaration
protected override bool TryComputeLength(out long length)
Parameters
Type Name Description
System.Int64 length
Returns
Type Description
System.Boolean

true if it worked, in this case always