/// <summary> /// Creates a BsonWriter to a BsonBuffer. /// </summary> /// <param name="buffer">A BsonBuffer.</param> /// <param name="settings">Optional BsonBinaryWriterSettings.</param> /// <returns>A BsonWriter.</returns> public static BsonWriter Create(BsonBuffer buffer, BsonBinaryWriterSettings settings) { return(new BsonBinaryWriter(null, buffer, settings)); }
/// <summary> /// Creates a BsonReader for a BsonBuffer. /// </summary> /// <param name="buffer">The BsonBuffer.</param> /// <param name="settings">Optional reader settings.</param> /// <returns>A BsonReader.</returns> public static BsonReader Create(BsonBuffer buffer, BsonBinaryReaderSettings settings) { return(new BsonBinaryReader(buffer, settings)); }
// public static methods /// <summary> /// Creates a BsonReader for a BsonBuffer. /// </summary> /// <param name="buffer">The BsonBuffer.</param> /// <returns>A BsonReader.</returns> public static BsonReader Create(BsonBuffer buffer) { return(Create(buffer, BsonBinaryReaderSettings.Defaults)); }
// constructors /// <summary> /// Initializes a new instance of the BsonBinaryWriter class. /// </summary> /// <param name="stream">A stream.</param> /// <param name="buffer">A BsonBuffer.</param> /// <param name="settings">Optional BsonBinaryWriter settings.</param> public BsonBinaryWriter(Stream stream, BsonBuffer buffer, BsonBinaryWriterSettings settings) : this(buffer ?? new BsonBuffer(), buffer == null, settings) { _stream = stream; }