Table of Contents

Class PooledBufferedStream

Namespace
Geotab.Checkmate.ObjectModel
Assembly
Geotab.Checkmate.ObjectModel.dll

A wrapped stream with custom flushing logic to ensure the buffer is cleared regularly.

public class PooledBufferedStream : Stream, IDisposable, IAsyncDisposable
Inheritance
PooledBufferedStream
Implements
Inherited Members

Constructors

PooledBufferedStream(Stream, int, ArrayPool<byte>, in CancellationToken)

Initializes a new instance of the PooledBufferedStream class.

public PooledBufferedStream(Stream stream, int bufferSize, ArrayPool<byte> bytePool, in CancellationToken cancellationToken)

Parameters

stream Stream

The stream.

bufferSize int

The bufferSize.

bytePool ArrayPool<byte>

The bytePool.

cancellationToken CancellationToken

The cancellationToken.

Exceptions

ArgumentNullException

Stream or byte pool is null.

ArgumentOutOfRangeException

Buffer size is less than or equal to 0

ArgumentException

Stream is not writable

Fields

DefaultBufferSize

Default buffer size for the PooledBufferedStream.

public const int DefaultBufferSize = 16384

Field Value

int

Properties

CanRead

public override bool CanRead { get; }

Property Value

bool

CanSeek

public override bool CanSeek { get; }

Property Value

bool

CanTimeout

public override bool CanTimeout { get; }

Property Value

bool

CanWrite

public override bool CanWrite { get; }

Property Value

bool

Length

public override long Length { get; }

Property Value

long

Position

public override long Position { get; set; }

Property Value

long

Methods

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

DisposeAsync()

public override ValueTask DisposeAsync()

Returns

ValueTask

Flush()

public override void Flush()

Read(byte[], int, int)

public override int Read(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int

Returns

int

Seek(long, SeekOrigin)

public override long Seek(long offset, SeekOrigin origin)

Parameters

offset long
origin SeekOrigin

Returns

long

SetLength(long)

public override void SetLength(long value)

Parameters

value long

Write(byte[], int, int)

public override void Write(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int