classafBson::BsonWriter

sys::Obj
  afBson::BsonWriter

Wraps an OutStream to write BSON objects.

CAUTION: INTEGER_32 values will be read as Int values. If you then write its containing document, the storage type will be converted to INTEGER_64.

This is only of concern if other, non Fantom drivers, are writing to the database.

cache

Source

Obj? cache(|->Obj? c)

flush

Source

This flush()

Flushes the underlying OutStream.

make

Source

new make(OutStream? out)

Creates a BsonWriter, wrapping the given OutSteam As per the BSON spec, the stream's endian is set to little.

out may be null if the writer is just being used to size documents.

out

Source

OutStream? out { private set }

The underlying OutStream.

sizeCString

Source

Int sizeCString(Str cstr)

Calculates the size (in bytes) of the given Str should it be serialised as a null terminated CString. Nothing is written to the OutStream.

sizeDocument

Source

Int sizeDocument([Obj:Obj?]? document)

Calculates the size (in bytes) of the given BSON Document should it be serialised. Nothing is written to the OutStream.

writeCString

Source

This writeCString(Str cstr)

Writes a null terminated BSON string to OutStream.

writeDocument

Source

This writeDocument([Obj:Obj?]? document)

Serialises the given BSON Document to the underlying OutStream.

writeInteger32

Source

This writeInteger32(Int int32)

Writes a 32 bit integer value to OutStream. Unlike storing Ints in a Document, this method will write an actual INTEGER_32.

writeInteger64

Source

This writeInteger64(Int int64)

Writes a 64 bit integer value to OutStream.