Class BsonStream
Represents a Stream has additional methods to suport reading and writing BSON values.
public abstract class BsonStream : Stream, IDisposable
- Inheritance
-
BsonStream
- Implements
- Derived
- Inherited Members
- Extension Methods
Methods
ReadCString(UTF8Encoding)
Reads a BSON CString from the stream.
public abstract string ReadCString(UTF8Encoding encoding)
Parameters
encoding
UTF8EncodingThe encoding.
Returns
- string
A string.
ReadCStringBytes()
Reads a BSON CString from the stream.
public abstract ArraySegment<byte> ReadCStringBytes()
Returns
- ArraySegment<byte>
An ArraySegment containing the CString bytes (without the null byte).
ReadDecimal128()
Reads a BSON Decimal128 from the stream.
public abstract Decimal128 ReadDecimal128()
Returns
ReadDouble()
Reads a BSON double from the stream.
public abstract double ReadDouble()
Returns
- double
A double.
ReadInt32()
Reads a 32-bit BSON integer from the stream.
public abstract int ReadInt32()
Returns
- int
An int.
ReadInt64()
Reads a 64-bit BSON integer from the stream.
public abstract long ReadInt64()
Returns
- long
A long.
ReadObjectId()
Reads a BSON ObjectId from the stream.
public abstract ObjectId ReadObjectId()
Returns
- ObjectId
An ObjectId.
ReadSlice()
Reads a raw length prefixed slice from the stream.
public abstract IByteBuffer ReadSlice()
Returns
- IByteBuffer
A slice.
ReadString(UTF8Encoding)
Reads a BSON string from the stream.
public abstract string ReadString(UTF8Encoding encoding)
Parameters
encoding
UTF8EncodingThe encoding.
Returns
- string
A string.
SkipCString()
Skips over a BSON CString leaving the stream positioned just after the terminating null byte.
public abstract void SkipCString()
WriteCString(string)
Writes a BSON CString to the stream.
public abstract void WriteCString(string value)
Parameters
value
stringThe value.
WriteCStringBytes(byte[])
Writes the CString bytes to the stream.
public abstract void WriteCStringBytes(byte[] value)
Parameters
value
byte[]The value.
WriteDecimal128(Decimal128)
Writes a BSON Decimal128 to the stream.
public abstract void WriteDecimal128(Decimal128 value)
Parameters
value
Decimal128The value.
WriteDouble(double)
Writes a BSON double to the stream.
public abstract void WriteDouble(double value)
Parameters
value
doubleThe value.
WriteInt32(int)
Writes a 32-bit BSON integer to the stream.
public abstract void WriteInt32(int value)
Parameters
value
intThe value.
WriteInt64(long)
Writes a 64-bit BSON integer to the stream.
public abstract void WriteInt64(long value)
Parameters
value
longThe value.
WriteObjectId(ObjectId)
Writes a BSON ObjectId to the stream.
public abstract void WriteObjectId(ObjectId value)
Parameters
value
ObjectIdThe value.
WriteString(string, UTF8Encoding)
Writes a BSON string to the stream.
public abstract void WriteString(string value, UTF8Encoding encoding)
Parameters
value
stringThe value.
encoding
UTF8EncodingThe encoding.