Try our conversational search powered by Generative AI!

Class TrackableStream

A stream that can wrap any System.IO.Stream that exposes events when the stream is closing and closed.

Inheritance
System.Object
System.MarshalByRefObject
System.IO.Stream
TrackableStream
Implements
System.IDisposable
Inherited Members
System.IO.Stream.Null
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.Dispose()
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.ReadByte()
System.IO.Stream.WriteByte(System.Byte)
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.CreateObjRef(System.Type)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Blobs
Assembly: EPiServer.Framework.dll
Version: 11.20.7
Syntax
public class TrackableStream : Stream, IDisposable

Constructors

TrackableStream(Stream)

Initializes a new instance of the TrackableStream class.

Declaration
public TrackableStream(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

The stream that should be wrapped and tracked

Properties

CanRead

Declaration
public override bool CanRead { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanRead

CanSeek

Declaration
public override bool CanSeek { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanSeek

CanWrite

Declaration
public override bool CanWrite { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanWrite

InnerStream

Gets the System.IO.Stream that is tracked using this class.

Declaration
public virtual Stream InnerStream { get; }
Property Value
Type Description
System.IO.Stream

Length

Declaration
public override long Length { get; }
Property Value
Type Description
System.Int64
Overrides
System.IO.Stream.Length

Position

Declaration
public override long Position { get; set; }
Property Value
Type Description
System.Int64
Overrides
System.IO.Stream.Position

Methods

Close()

Declaration
public override void Close()
Overrides
System.IO.Stream.Close()

Dispose(Boolean)

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing
Overrides
System.IO.Stream.Dispose(System.Boolean)

Flush()

Declaration
public override void Flush()
Overrides
System.IO.Stream.Flush()

Read(Byte[], Int32, Int32)

Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer
System.Int32 offset
System.Int32 count
Returns
Type Description
System.Int32
Overrides
System.IO.Stream.Read(System.Byte[], System.Int32, System.Int32)

Seek(Int64, SeekOrigin)

Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type Name Description
System.Int64 offset
System.IO.SeekOrigin origin
Returns
Type Description
System.Int64
Overrides
System.IO.Stream.Seek(System.Int64, System.IO.SeekOrigin)

SetLength(Int64)

Declaration
public override void SetLength(long value)
Parameters
Type Name Description
System.Int64 value
Overrides
System.IO.Stream.SetLength(System.Int64)

Write(Byte[], Int32, Int32)

Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer
System.Int32 offset
System.Int32 count
Overrides
System.IO.Stream.Write(System.Byte[], System.Int32, System.Int32)

Events

Closed

Called after the stream is closed

Declaration
public event EventHandler<EventArgs> Closed
Event Type
Type Description
System.EventHandler<System.EventArgs>

Closing

Called before the stream is closed

Declaration
public event EventHandler<EventArgs> Closing
Event Type
Type Description
System.EventHandler<System.EventArgs>

Implements

System.IDisposable

Extension Methods