FileBufferingReadStream Class

A Stream that wraps another stream and enables rewinding by buffering the content as it is read. The content is buffered in memory up to a certain size and then spooled to a temp file on disk. The temp file will be deleted on Dispose.

Namespace
Microsoft.AspNetCore.WebUtilities
Assemblies
  • Microsoft.AspNetCore.WebUtilities

Inheritance Hierarchy

Syntax

public class FileBufferingReadStream : Stream, IDisposable
class Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream

Constructors

FileBufferingReadStream(System.IO.Stream, System.Int32, System.Nullable<System.Int64>, System.Func<System.String>)
public FileBufferingReadStream(Stream inner, int memoryThreshold, long ? bufferLimit, Func<string> tempFileDirectoryAccessor)
FileBufferingReadStream(System.IO.Stream, System.Int32, System.Nullable<System.Int64>, System.Func<System.String>, System.Buffers.ArrayPool<System.Byte>)
public FileBufferingReadStream(Stream inner, int memoryThreshold, long ? bufferLimit, Func<string> tempFileDirectoryAccessor, ArrayPool<byte> bytePool)
FileBufferingReadStream(System.IO.Stream, System.Int32, System.Nullable<System.Int64>, System.String)
public FileBufferingReadStream(Stream inner, int memoryThreshold, long ? bufferLimit, string tempFileDirectory)
FileBufferingReadStream(System.IO.Stream, System.Int32, System.Nullable<System.Int64>, System.String, System.Buffers.ArrayPool<System.Byte>)
public FileBufferingReadStream(Stream inner, int memoryThreshold, long ? bufferLimit, string tempFileDirectory, ArrayPool<byte> bytePool)

Methods

BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
Return type:System.IAsyncResult
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
Return type:System.IAsyncResult
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Dispose(System.Boolean)
protected override void Dispose(bool disposing)
EndRead(System.IAsyncResult)
Return type:System.Int32
public override int EndRead(IAsyncResult asyncResult)
EndWrite(System.IAsyncResult)
public override void EndWrite(IAsyncResult asyncResult)
Flush()
public override void Flush()
Read(System.Byte[], System.Int32, System.Int32)
Return type:System.Int32
public override int Read(byte[] buffer, int offset, int count)
ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
Return type:System.Threading.Tasks.Task<System.Int32>
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Seek(System.Int64, System.IO.SeekOrigin)
Return type:System.Int64
public override long Seek(long offset, SeekOrigin origin)
SetLength(System.Int64)
public override void SetLength(long value)
Write(System.Byte[], System.Int32, System.Int32)
public override void Write(byte[] buffer, int offset, int count)
WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
Return type:System.Threading.Tasks.Task
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)

Properties

Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.CanRead
Return type:System.Boolean
public override bool CanRead { get; }
Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.CanSeek
Return type:System.Boolean
public override bool CanSeek { get; }
Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.CanWrite
Return type:System.Boolean
public override bool CanWrite { get; }
Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.InMemory
Return type:System.Boolean
public bool InMemory { get; }
Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.Length
Return type:System.Int64
public override long Length { get; }
Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.Position
Return type:System.Int64
public override long Position { get; set; }
Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.TempFileName
Return type:System.String
public string TempFileName { get; }