Class BsonStreamAdapter
A Stream that wraps another Stream while implementing the BsonStream abstract methods.
public sealed class BsonStreamAdapter : BsonStream, IAsyncDisposable, IDisposable
- Inheritance
-
BsonStreamAdapter
- Implements
- Inherited Members
- Extension Methods
Constructors
- BsonStreamAdapter(Stream, bool)
Initializes a new instance of the BsonStreamAdapter class.
Properties
- BaseStream
Gets the base stream.
- 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.
- CanTimeout
Gets a value that determines whether the current stream can time out.
- CanWrite
When overridden in a derived class, gets a value indicating whether the current stream supports writing.
- Length
When overridden in a derived class, gets the length in bytes of the stream.
- Position
When overridden in a derived class, gets or sets the position within the current stream.
- ReadTimeout
Gets or sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.
- WriteTimeout
Gets or sets a value, in milliseconds, that determines how long the stream will attempt to write before timing out.
Methods
- BeginRead(byte[], int, int, AsyncCallback, object)
Begins an asynchronous read operation. (Consider using ReadAsync(byte[], int, int) instead.)
- BeginWrite(byte[], int, int, AsyncCallback, object)
Begins an asynchronous write operation. (Consider using WriteAsync(byte[], int, int) instead.)
- Close()
Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.
- CopyToAsync(Stream, int, CancellationToken)
Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.
- Dispose(bool)
Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
- EndRead(IAsyncResult)
Waits for the pending asynchronous read to complete. (Consider using ReadAsync(byte[], int, int) instead.)
- EndWrite(IAsyncResult)
Ends an asynchronous write operation. (Consider using WriteAsync(byte[], int, int) instead.)
- 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.
- FlushAsync(CancellationToken)
Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
- Read(byte[], int, int)
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[], int, int, 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.
- ReadByte()
Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
- ReadCString(UTF8Encoding)
Reads a BSON CString from the stream.
- ReadCStringBytes()
Reads a BSON CString from the stream.
- ReadDecimal128()
Reads a BSON Decimal128 from the stream.
- ReadDouble()
Reads a BSON double from the stream.
- ReadInt32()
Reads a 32-bit BSON integer from the stream.
- ReadInt64()
Reads a 64-bit BSON integer from the stream.
- ReadObjectId()
Reads a BSON ObjectId from the stream.
- ReadSlice()
Reads a raw length prefixed slice from the stream.
- ReadString(UTF8Encoding)
Reads a BSON string from the stream.
- Seek(long, SeekOrigin)
When overridden in a derived class, sets the position within the current stream.
- SetLength(long)
When overridden in a derived class, sets the length of the current stream.
- SkipCString()
Skips over a BSON CString leaving the stream positioned just after the terminating null byte.
- Write(byte[], int, int)
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[], int, int, 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.
- WriteByte(byte)
Writes a byte to the current position in the stream and advances the position within the stream by one byte.
- WriteCString(string)
Writes a BSON CString to the stream.
- WriteCStringBytes(byte[])
Writes the CString bytes to the stream.
- WriteDecimal128(Decimal128)
Writes a BSON Decimal128 to the stream.
- WriteDouble(double)
Writes a BSON double to the stream.
- WriteInt32(int)
Writes a 32-bit BSON integer to the stream.
- WriteInt64(long)
Writes a 64-bit BSON integer to the stream.
- WriteObjectId(ObjectId)
Writes a BSON ObjectId to the stream.
- WriteString(string, UTF8Encoding)
Writes a BSON string to the stream.