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
StreamThe stream.
bufferSize
intThe bufferSize.
bytePool
ArrayPool<byte>The bytePool.
cancellationToken
CancellationTokenThe 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
Properties
CanRead
public override bool CanRead { get; }
Property Value
CanSeek
public override bool CanSeek { get; }
Property Value
CanTimeout
public override bool CanTimeout { get; }
Property Value
CanWrite
public override bool CanWrite { get; }
Property Value
Length
public override long Length { get; }
Property Value
Position
public override long Position { get; set; }
Property Value
Methods
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
DisposeAsync()
public override ValueTask DisposeAsync()
Returns
Flush()
public override void Flush()
Read(byte[], int, int)
public override int Read(byte[] buffer, int offset, int count)
Parameters
Returns
Seek(long, SeekOrigin)
public override long Seek(long offset, SeekOrigin origin)
Parameters
offset
longorigin
SeekOrigin
Returns
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)