Table of Contents

Class ByteBufferStream

Namespace
MongoDB.Bson.IO
Assembly
MongoDB.Bson.dll

Represents a Stream backed by an IByteBuffer. Similar to MemoryStream but backed by an IByteBuffer instead of a byte array and also implements the BsonStream interface for higher performance BSON I/O.

public class ByteBufferStream : BsonStream, IAsyncDisposable, IDisposable, IStreamEfficientCopyTo
Inheritance
ByteBufferStream
Implements
Inherited Members
Extension Methods

Constructors

ByteBufferStream(IByteBuffer, bool)

Initializes a new instance of the ByteBufferStream class.

Properties

Buffer

Gets the buffer.

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.

Methods

Dispose(bool)

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

EfficientCopyTo(Stream)

Copy the current stream to the destination without making unnecessary copies of the bytes.

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[], 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.

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.

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.