Show / Hide Table of Contents

Class StreamTransferObject

Represents object which content is represented by Stream.

Inheritance
Object
StreamTransferObject
Implements
IDataTransferObject
IAsyncDisposable
Namespace: DotNext.IO
Assembly: DotNext.IO.dll
Syntax
public class StreamTransferObject : Disposable, IDataTransferObject, IAsyncDisposable

Constructors

| Improve this Doc View Source

StreamTransferObject(Stream, Boolean)

Initializes a new message.

Declaration
public StreamTransferObject(Stream content, bool leaveOpen)
Parameters
Type Name Description
Stream content

The message content.

Boolean leaveOpen

true to leave the stream open after StreamTransferObject object is disposed; otherwise, false.

Properties

| Improve this Doc View Source

IsReusable

Indicates that the content of this message can be copied to the output stream or pipe multiple times.

Declaration
public virtual bool IsReusable { get; }
Property Value
Type Description
Boolean

Methods

| Improve this Doc View Source

Dispose(Boolean)

Releases resources associated with this object.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

true if called from ; false if called from finalizer .

| Improve this Doc View Source

DisposeAsync()

Asynchronously releases the resources associated with this object.

Declaration
public virtual ValueTask DisposeAsync()
Returns
Type Description
ValueTask

A task that represents the asynchronous dispose operation.

| Improve this Doc View Source

GetObjectDataAsync<TResult, TDecoder>(TDecoder, CancellationToken)

Parses the encapsulated stream.

Declaration
public ValueTask<TResult> GetObjectDataAsync<TResult, TDecoder>(TDecoder parser, CancellationToken token = default(CancellationToken))

    where TDecoder : IDataTransferObject.IDecoder<TResult>
Parameters
Type Name Description
TDecoder parser

The parser instance.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The converted DTO content.

Type Parameters
Name Description
TResult

The type of result.

TDecoder

The type of parser.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

LoadFromAsync(IDataTransferObject, CancellationToken)

Loads the content from another data transfer object.

Declaration
public ValueTask LoadFromAsync(IDataTransferObject source, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
IDataTransferObject source

The content source.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing asynchronous state of content loading.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

NotSupportedException

The underlying stream does not support seeking.

Explicit Interface Implementations

| Improve this Doc View Source

IDataTransferObject.Length

Declaration
long? IDataTransferObject.Length { get; }
Returns
Type Description
Nullable<Int64>
| Improve this Doc View Source

IDataTransferObject.WriteToAsync<TWriter>(TWriter, CancellationToken)

Declaration
ValueTask IDataTransferObject.WriteToAsync<TWriter>(TWriter writer, CancellationToken token)

    where TWriter : IAsyncBinaryWriter
Parameters
Type Name Description
TWriter writer
CancellationToken token
Returns
Type Description
ValueTask
Type Parameters
Name Description
TWriter

Implements

IDataTransferObject
System.IAsyncDisposable

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, Memory<Byte>, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, Int32, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, PipeWriter, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, IBufferWriter<Byte>, CancellationToken)
DataTransferObject.ToStringAsync<TObject>(TObject, Encoding, CancellationToken)
DataTransferObject.ToStringAsync<TObject>(TObject, Encoding, Int32, CancellationToken)
DataTransferObject.ToByteArrayAsync<TObject>(TObject, CancellationToken)
DataTransferObject.ToType<TResult, TObject>(TObject, CancellationToken)
DataTransferObject.GetObjectDataAsync<TResult, TObject>(TObject, CancellationToken)
DataTransferObject.GetObjectDataAsync<TResult, TObject>(TObject, Func<IAsyncBinaryReader, CancellationToken, ValueTask<TResult>>, CancellationToken)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX