Share via


FileBufferingReadStream Class

Definition

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.

public ref class FileBufferingReadStream : System::IO::Stream
public class FileBufferingReadStream : System.IO.Stream
type FileBufferingReadStream = class
    inherit Stream
Public Class FileBufferingReadStream
Inherits Stream
Inheritance
FileBufferingReadStream

Constructors

FileBufferingReadStream(Stream, Int32, Nullable<Int64>, Func<String>, ArrayPool<Byte>)

Initializes a new instance of FileBufferingReadStream.

FileBufferingReadStream(Stream, Int32, Nullable<Int64>, Func<String>)

Initializes a new instance of FileBufferingReadStream.

FileBufferingReadStream(Stream, Int32, Nullable<Int64>, String, ArrayPool<Byte>)

Initializes a new instance of FileBufferingReadStream.

FileBufferingReadStream(Stream, Int32, Nullable<Int64>, String)

Initializes a new instance of FileBufferingReadStream.

FileBufferingReadStream(Stream, Int32)

Initializes a new instance of FileBufferingReadStream.

Properties

CanRead

When overridden in a derived class, gets a value indicating whether the current stream supports reading.

CanSeek

When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

CanWrite

When overridden in a derived class, gets a value indicating whether the current stream supports writing.

InMemory

Gets a value that determines if the contents are buffered entirely in memory.

Length

The total bytes read from and buffered by the stream so far, it will not represent the full data length until the stream is fully buffered. e.g. using stream.DrainAsync().

MemoryThreshold

The maximum amount of memory in bytes to allocate before switching to a file on disk.

Position

When overridden in a derived class, gets or sets the position within the current stream.

TempFileName

Gets a value that determines where the contents are buffered on disk.

Methods

CopyToAsync(Stream, Int32, CancellationToken)

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token. Both streams positions are advanced by the number of bytes copied.

Dispose(Boolean)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

DisposeAsync()

Asynchronously releases the unmanaged resources used by the Stream.

Flush()

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

Read(Byte[], Int32, Int32)

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Read(Span<Byte>)

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadAsync(Byte[], Int32, Int32, CancellationToken)

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

ReadAsync(Memory<Byte>, CancellationToken)

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

Seek(Int64, SeekOrigin)

When overridden in a derived class, sets the position within the current stream.

SetLength(Int64)

When overridden in a derived class, sets the length of the current stream.

Write(Byte[], Int32, Int32)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

WriteAsync(Byte[], Int32, Int32, CancellationToken)

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

Applies to