C# Class MongoDB.Bson.IO.BsonWriter

Represents a BSON writer for some external format (see subclasses).
Inheritance: IDisposable
Show file Open project: egametang/Egametang Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Closes the writer.

Create ( BsonBinaryWriterSettings settings ) : BsonWriter

Creates a BsonWriter to a BsonBuffer.

Create ( MongoDB.Bson.IO.BsonBuffer buffer ) : BsonWriter

Creates a BsonWriter to a BsonBuffer.

Create ( MongoDB.Bson.IO.BsonBuffer buffer, BsonBinaryWriterSettings settings ) : BsonWriter

Creates a BsonWriter to a BsonBuffer.

Create ( BsonDocument document ) : BsonWriter

Creates a BsonWriter to a BsonDocument.

Create ( BsonDocument document, BsonDocumentWriterSettings settings ) : BsonWriter

Creates a BsonWriter to a BsonDocument.

Create ( Stream stream ) : BsonWriter

Creates a BsonWriter to a BSON Stream.

Create ( Stream stream, BsonBinaryWriterSettings settings ) : BsonWriter

Creates a BsonWriter to a BSON Stream.

Create ( TextWriter writer ) : BsonWriter

Creates a BsonWriter to a JSON TextWriter.

Create ( TextWriter writer, JsonWriterSettings settings ) : BsonWriter

Creates a BsonWriter to a JSON TextWriter.

Dispose ( ) : void

Disposes of any resources used by the writer.

Flush ( ) : void

Flushes any pending data to the output destination.

WriteBinaryData ( BsonBinaryData binaryData ) : void

Writes BSON binary data to the writer.

WriteBinaryData ( string name, BsonBinaryData binaryData ) : void

Writes a BSON binary data element to the writer.

WriteBoolean ( bool value ) : void

Writes a BSON Boolean to the writer.

WriteBoolean ( string name, bool value ) : void

Writes a BSON Boolean element to the writer.

WriteBytes ( byte bytes ) : void

Writes BSON binary data to the writer.

WriteBytes ( string name, byte bytes ) : void

Writes a BSON binary data element to the writer.

WriteDateTime ( long value ) : void

Writes a BSON DateTime to the writer.

WriteDateTime ( string name, long value ) : void

Writes a BSON DateTime element to the writer.

WriteDouble ( double value ) : void

Writes a BSON Double to the writer.

WriteDouble ( string name, double value ) : void

Writes a BSON Double element to the writer.

WriteEndArray ( ) : void

Writes the end of a BSON array to the writer.

WriteEndDocument ( ) : void

Writes the end of a BSON document to the writer.

WriteInt32 ( int value ) : void

Writes a BSON Int32 to the writer.

WriteInt32 ( string name, int value ) : void

Writes a BSON Int32 element to the writer.

WriteInt64 ( long value ) : void

Writes a BSON Int64 to the writer.

WriteInt64 ( string name, long value ) : void

Writes a BSON Int64 element to the writer.

WriteJavaScript ( string code ) : void

Writes a BSON JavaScript to the writer.

WriteJavaScript ( string name, string code ) : void

Writes a BSON JavaScript element to the writer.

WriteJavaScriptWithScope ( string code ) : void

Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).

WriteJavaScriptWithScope ( string name, string code ) : void

Writes a BSON JavaScript element to the writer (call WriteStartDocument to start writing the scope).

WriteMaxKey ( ) : void

Writes a BSON MaxKey to the writer.

WriteMaxKey ( string name ) : void

Writes a BSON MaxKey element to the writer.

WriteMinKey ( ) : void

Writes a BSON MinKey to the writer.

WriteMinKey ( string name ) : void

Writes a BSON MinKey element to the writer.

WriteName ( string name ) : void

Writes the name of an element to the writer.

WriteNull ( ) : void

Writes a BSON null to the writer.

WriteNull ( string name ) : void

Writes a BSON null element to the writer.

WriteObjectId ( ObjectId objectId ) : void

Writes a BSON ObjectId to the writer.

WriteObjectId ( string name, ObjectId objectId ) : void

Writes a BSON ObjectId element to the writer.

WriteRawBsonArray ( IByteBuffer slice ) : void

Writes a raw BSON array.

WriteRawBsonArray ( string name, IByteBuffer slice ) : void

Writes a raw BSON array.

WriteRawBsonDocument ( IByteBuffer slice ) : void

Writes a raw BSON document.

WriteRawBsonDocument ( string name, IByteBuffer slice ) : void

Writes a raw BSON document.

WriteRegularExpression ( BsonRegularExpression regex ) : void

Writes a BSON regular expression to the writer.

WriteRegularExpression ( string name, BsonRegularExpression regex ) : void

Writes a BSON regular expression element to the writer.

WriteStartArray ( ) : void

Writes the start of a BSON array to the writer.

WriteStartArray ( string name ) : void

Writes the start of a BSON array element to the writer.

WriteStartDocument ( ) : void

Writes the start of a BSON document to the writer.

WriteStartDocument ( string name ) : void

Writes the start of a BSON document element to the writer.

WriteString ( string value ) : void

Writes a BSON String to the writer.

WriteString ( string name, string value ) : void

Writes a BSON String element to the writer.

WriteSymbol ( string value ) : void

Writes a BSON Symbol to the writer.

WriteSymbol ( string name, string value ) : void

Writes a BSON Symbol element to the writer.

WriteTimestamp ( long value ) : void

Writes a BSON timestamp to the writer.

WriteTimestamp ( string name, long value ) : void

Writes a BSON timestamp element to the writer.

WriteUndefined ( ) : void

Writes a BSON undefined to the writer.

WriteUndefined ( string name ) : void

Writes a BSON undefined element to the writer.

Protected Methods

Method Description
BsonWriter ( BsonWriterSettings settings ) : System

Initializes a new instance of the BsonWriter class.

CheckElementName ( string name ) : void

Checks that the element name is valid.

Dispose ( bool disposing ) : void

Disposes of any resources used by the writer.

ThrowInvalidContextType ( string methodName, ContextType actualContextType ) : void

Throws an InvalidOperationException when the method called is not valid for the current ContextType.

ThrowInvalidState ( string methodName ) : void

Throws an InvalidOperationException when the method called is not valid for the current state.

Private Methods

Method Description
WriteBinaryData ( byte bytes, BsonBinarySubType subType ) : void
WriteBinaryData ( byte bytes, BsonBinarySubType subType, GuidRepresentation guidRepresentation ) : void
WriteBinaryData ( string name, byte bytes, BsonBinarySubType subType ) : void
WriteBinaryData ( string name, byte bytes, BsonBinarySubType subType, GuidRepresentation guidRepresentation ) : void
WriteObjectId ( int timestamp, int machine, short pid, int increment ) : void
WriteObjectId ( string name, int timestamp, int machine, short pid, int increment ) : void
WriteRegularExpression ( string pattern, string options ) : void
WriteRegularExpression ( string name, string pattern, string options ) : void

Method Details

BsonWriter() protected method

Initializes a new instance of the BsonWriter class.
protected BsonWriter ( BsonWriterSettings settings ) : System
settings BsonWriterSettings The writer settings.
return System

CheckElementName() protected method

Checks that the element name is valid.
protected CheckElementName ( string name ) : void
name string The element name to be checked.
return void

Close() public abstract method

Closes the writer.
public abstract Close ( ) : void
return void

Create() public static method

Creates a BsonWriter to a BsonBuffer.
public static Create ( BsonBinaryWriterSettings settings ) : BsonWriter
settings BsonBinaryWriterSettings Optional BsonBinaryWriterSettings.
return BsonWriter

Create() public static method

Creates a BsonWriter to a BsonBuffer.
public static Create ( MongoDB.Bson.IO.BsonBuffer buffer ) : BsonWriter
buffer MongoDB.Bson.IO.BsonBuffer A BsonBuffer.
return BsonWriter

Create() public static method

Creates a BsonWriter to a BsonBuffer.
public static Create ( MongoDB.Bson.IO.BsonBuffer buffer, BsonBinaryWriterSettings settings ) : BsonWriter
buffer MongoDB.Bson.IO.BsonBuffer A BsonBuffer.
settings BsonBinaryWriterSettings Optional BsonBinaryWriterSettings.
return BsonWriter

Create() public static method

Creates a BsonWriter to a BsonDocument.
public static Create ( BsonDocument document ) : BsonWriter
document BsonDocument A BsonDocument.
return BsonWriter

Create() public static method

Creates a BsonWriter to a BsonDocument.
public static Create ( BsonDocument document, BsonDocumentWriterSettings settings ) : BsonWriter
document BsonDocument A BsonDocument.
settings BsonDocumentWriterSettings The settings.
return BsonWriter

Create() public static method

Creates a BsonWriter to a BSON Stream.
public static Create ( Stream stream ) : BsonWriter
stream Stream A Stream.
return BsonWriter

Create() public static method

Creates a BsonWriter to a BSON Stream.
public static Create ( Stream stream, BsonBinaryWriterSettings settings ) : BsonWriter
stream Stream A Stream.
settings BsonBinaryWriterSettings Optional BsonBinaryWriterSettings.
return BsonWriter

Create() public static method

Creates a BsonWriter to a JSON TextWriter.
public static Create ( TextWriter writer ) : BsonWriter
writer System.IO.TextWriter A TextWriter.
return BsonWriter

Create() public static method

Creates a BsonWriter to a JSON TextWriter.
public static Create ( TextWriter writer, JsonWriterSettings settings ) : BsonWriter
writer System.IO.TextWriter A TextWriter.
settings JsonWriterSettings Optional JsonWriterSettings.
return BsonWriter

Dispose() public method

Disposes of any resources used by the writer.
public Dispose ( ) : void
return void

Dispose() protected method

Disposes of any resources used by the writer.
protected Dispose ( bool disposing ) : void
disposing bool True if called from Dispose.
return void

Flush() public abstract method

Flushes any pending data to the output destination.
public abstract Flush ( ) : void
return void

ThrowInvalidContextType() protected method

Throws an InvalidOperationException when the method called is not valid for the current ContextType.
protected ThrowInvalidContextType ( string methodName, ContextType actualContextType ) : void
methodName string The name of the method.
actualContextType ContextType The actual ContextType.
return void

ThrowInvalidState() protected method

Throws an InvalidOperationException when the method called is not valid for the current state.
protected ThrowInvalidState ( string methodName ) : void
methodName string The name of the method.
return void

WriteBinaryData() public abstract method

Writes BSON binary data to the writer.
public abstract WriteBinaryData ( BsonBinaryData binaryData ) : void
binaryData BsonBinaryData The binary data.
return void

WriteBinaryData() public method

Writes a BSON binary data element to the writer.
public WriteBinaryData ( string name, BsonBinaryData binaryData ) : void
name string The name of the element.
binaryData BsonBinaryData The binary data.
return void

WriteBoolean() public abstract method

Writes a BSON Boolean to the writer.
public abstract WriteBoolean ( bool value ) : void
value bool The Boolean value.
return void

WriteBoolean() public method

Writes a BSON Boolean element to the writer.
public WriteBoolean ( string name, bool value ) : void
name string The name of the element.
value bool The Boolean value.
return void

WriteBytes() public abstract method

Writes BSON binary data to the writer.
public abstract WriteBytes ( byte bytes ) : void
bytes byte The bytes.
return void

WriteBytes() public method

Writes a BSON binary data element to the writer.
public WriteBytes ( string name, byte bytes ) : void
name string The name of the element.
bytes byte The bytes.
return void

WriteDateTime() public abstract method

Writes a BSON DateTime to the writer.
public abstract WriteDateTime ( long value ) : void
value long The number of milliseconds since the Unix epoch.
return void

WriteDateTime() public method

Writes a BSON DateTime element to the writer.
public WriteDateTime ( string name, long value ) : void
name string The name of the element.
value long The number of milliseconds since the Unix epoch.
return void

WriteDouble() public abstract method

Writes a BSON Double to the writer.
public abstract WriteDouble ( double value ) : void
value double The Double value.
return void

WriteDouble() public method

Writes a BSON Double element to the writer.
public WriteDouble ( string name, double value ) : void
name string The name of the element.
value double The Double value.
return void

WriteEndArray() public method

Writes the end of a BSON array to the writer.
public WriteEndArray ( ) : void
return void

WriteEndDocument() public method

Writes the end of a BSON document to the writer.
public WriteEndDocument ( ) : void
return void

WriteInt32() public abstract method

Writes a BSON Int32 to the writer.
public abstract WriteInt32 ( int value ) : void
value int The Int32 value.
return void

WriteInt32() public method

Writes a BSON Int32 element to the writer.
public WriteInt32 ( string name, int value ) : void
name string The name of the element.
value int The Int32 value.
return void

WriteInt64() public abstract method

Writes a BSON Int64 to the writer.
public abstract WriteInt64 ( long value ) : void
value long The Int64 value.
return void

WriteInt64() public method

Writes a BSON Int64 element to the writer.
public WriteInt64 ( string name, long value ) : void
name string The name of the element.
value long The Int64 value.
return void

WriteJavaScript() public abstract method

Writes a BSON JavaScript to the writer.
public abstract WriteJavaScript ( string code ) : void
code string The JavaScript code.
return void

WriteJavaScript() public method

Writes a BSON JavaScript element to the writer.
public WriteJavaScript ( string name, string code ) : void
name string The name of the element.
code string The JavaScript code.
return void

WriteJavaScriptWithScope() public abstract method

Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).
public abstract WriteJavaScriptWithScope ( string code ) : void
code string The JavaScript code.
return void

WriteJavaScriptWithScope() public method

Writes a BSON JavaScript element to the writer (call WriteStartDocument to start writing the scope).
public WriteJavaScriptWithScope ( string name, string code ) : void
name string The name of the element.
code string The JavaScript code.
return void

WriteMaxKey() public abstract method

Writes a BSON MaxKey to the writer.
public abstract WriteMaxKey ( ) : void
return void

WriteMaxKey() public method

Writes a BSON MaxKey element to the writer.
public WriteMaxKey ( string name ) : void
name string The name of the element.
return void

WriteMinKey() public abstract method

Writes a BSON MinKey to the writer.
public abstract WriteMinKey ( ) : void
return void

WriteMinKey() public method

Writes a BSON MinKey element to the writer.
public WriteMinKey ( string name ) : void
name string The name of the element.
return void

WriteName() public method

Writes the name of an element to the writer.
public WriteName ( string name ) : void
name string The name of the element.
return void

WriteNull() public abstract method

Writes a BSON null to the writer.
public abstract WriteNull ( ) : void
return void

WriteNull() public method

Writes a BSON null element to the writer.
public WriteNull ( string name ) : void
name string The name of the element.
return void

WriteObjectId() public abstract method

Writes a BSON ObjectId to the writer.
public abstract WriteObjectId ( ObjectId objectId ) : void
objectId ObjectId The ObjectId.
return void

WriteObjectId() public method

Writes a BSON ObjectId element to the writer.
public WriteObjectId ( string name, ObjectId objectId ) : void
name string The name of the element.
objectId ObjectId The ObjectId.
return void

WriteRawBsonArray() public method

Writes a raw BSON array.
public WriteRawBsonArray ( IByteBuffer slice ) : void
slice IByteBuffer The byte buffer containing the raw BSON array.
return void

WriteRawBsonArray() public method

Writes a raw BSON array.
public WriteRawBsonArray ( string name, IByteBuffer slice ) : void
name string The name.
slice IByteBuffer The byte buffer containing the raw BSON array.
return void

WriteRawBsonDocument() public method

Writes a raw BSON document.
public WriteRawBsonDocument ( IByteBuffer slice ) : void
slice IByteBuffer The byte buffer containing the raw BSON document.
return void

WriteRawBsonDocument() public method

Writes a raw BSON document.
public WriteRawBsonDocument ( string name, IByteBuffer slice ) : void
name string The name.
slice IByteBuffer The byte buffer containing the raw BSON document.
return void

WriteRegularExpression() public abstract method

Writes a BSON regular expression to the writer.
public abstract WriteRegularExpression ( BsonRegularExpression regex ) : void
regex BsonRegularExpression A BsonRegularExpression.
return void

WriteRegularExpression() public method

Writes a BSON regular expression element to the writer.
public WriteRegularExpression ( string name, BsonRegularExpression regex ) : void
name string The name of the element.
regex BsonRegularExpression A BsonRegularExpression.
return void

WriteStartArray() public method

Writes the start of a BSON array to the writer.
public WriteStartArray ( ) : void
return void

WriteStartArray() public method

Writes the start of a BSON array element to the writer.
public WriteStartArray ( string name ) : void
name string The name of the element.
return void

WriteStartDocument() public method

Writes the start of a BSON document to the writer.
public WriteStartDocument ( ) : void
return void

WriteStartDocument() public method

Writes the start of a BSON document element to the writer.
public WriteStartDocument ( string name ) : void
name string The name of the element.
return void

WriteString() public abstract method

Writes a BSON String to the writer.
public abstract WriteString ( string value ) : void
value string The String value.
return void

WriteString() public method

Writes a BSON String element to the writer.
public WriteString ( string name, string value ) : void
name string The name of the element.
value string The String value.
return void

WriteSymbol() public abstract method

Writes a BSON Symbol to the writer.
public abstract WriteSymbol ( string value ) : void
value string The symbol.
return void

WriteSymbol() public method

Writes a BSON Symbol element to the writer.
public WriteSymbol ( string name, string value ) : void
name string The name of the element.
value string The symbol.
return void

WriteTimestamp() public abstract method

Writes a BSON timestamp to the writer.
public abstract WriteTimestamp ( long value ) : void
value long The combined timestamp/increment value.
return void

WriteTimestamp() public method

Writes a BSON timestamp element to the writer.
public WriteTimestamp ( string name, long value ) : void
name string The name of the element.
value long The combined timestamp/increment value.
return void

WriteUndefined() public abstract method

Writes a BSON undefined to the writer.
public abstract WriteUndefined ( ) : void
return void

WriteUndefined() public method

Writes a BSON undefined element to the writer.
public WriteUndefined ( string name ) : void
name string The name of the element.
return void