Closeable
, AutoCloseable
, BsonWriter
public class BsonBinaryWriter extends AbstractBsonWriter
Modifier and Type | Class | Description |
---|---|---|
protected class |
BsonBinaryWriter.Context |
|
protected class |
BsonBinaryWriter.Mark |
AbstractBsonWriter.State
Constructor | Description |
---|---|
BsonBinaryWriter(BsonWriterSettings settings,
BsonBinaryWriterSettings binaryWriterSettings,
BsonOutput bsonOutput) |
Construct an instance.
|
BsonBinaryWriter(BsonWriterSettings settings,
BsonBinaryWriterSettings binaryWriterSettings,
BsonOutput bsonOutput,
FieldNameValidator validator) |
Construct an instance.
|
BsonBinaryWriter(BsonOutput bsonOutput) |
Construct an instance.
|
BsonBinaryWriter(BsonOutput bsonOutput,
FieldNameValidator validator) |
Construct an instance.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
protected void |
doWriteBinaryData(BsonBinary value) |
Handles the logic of writing a
BsonBinary value |
void |
doWriteBoolean(boolean value) |
Handles the logic of writing a boolean value
|
protected void |
doWriteDateTime(long value) |
Handles the logic of writing a date time value
|
protected void |
doWriteDBPointer(BsonDbPointer value) |
Handles the logic of writing a DbPointer value
|
protected void |
doWriteDecimal128(Decimal128 value) |
Handles the logic of writing a Decimal128 value
|
protected void |
doWriteDouble(double value) |
Handles the logic of writing a Double value
|
protected void |
doWriteEndArray() |
Handles the logic of writing the end of an array
|
protected void |
doWriteEndDocument() |
Handles the logic of writing the end of a document
|
protected void |
doWriteInt32(int value) |
Handles the logic of writing an int32 value
|
protected void |
doWriteInt64(long value) |
Handles the logic of writing an int64 value
|
protected void |
doWriteJavaScript(String value) |
Handles the logic of writing a JavaScript function
|
protected void |
doWriteJavaScriptWithScope(String value) |
Handles the logic of writing a scoped JavaScript function
|
protected void |
doWriteMaxKey() |
Handles the logic of writing a Max key
|
protected void |
doWriteMinKey() |
Handles the logic of writing a Min key
|
void |
doWriteNull() |
Handles the logic of writing a Null value
|
void |
doWriteObjectId(ObjectId value) |
Handles the logic of writing an ObjectId
|
void |
doWriteRegularExpression(BsonRegularExpression value) |
Handles the logic of writing a regular expression
|
protected void |
doWriteStartArray() |
Handles the logic to start writing an array
|
protected void |
doWriteStartDocument() |
Handles the logic to start writing a document
|
void |
doWriteString(String value) |
Handles the logic of writing a String
|
void |
doWriteSymbol(String value) |
Handles the logic of writing a Symbol
|
void |
doWriteTimestamp(BsonTimestamp value) |
Handles the logic of writing a timestamp
|
void |
doWriteUndefined() |
Handles the logic of writing an Undefined value
|
void |
flush() |
Flushes any pending data to the output destination.
|
BsonBinaryWriterSettings |
getBinaryWriterSettings() |
|
BsonOutput |
getBsonOutput() |
Gets the BSON output backing this instance.
|
protected BsonBinaryWriter.Context |
getContext() |
Get the context, which will indicate which state the writer is in, for example which part of a document it's currently writing.
|
void |
mark() |
Create a snapshot of this writer's context at a point in time.
|
void |
pipe(BsonReader reader) |
Reads a single document from a BsonReader and writes it to this.
|
void |
pipe(BsonReader reader,
List<BsonElement> extraElements) |
Reads a single document from the given BsonReader and writes it to this, appending the given extra elements to the document.
|
void |
popMaxDocumentSize() |
Reset the maximum document size to its previous value.
|
void |
pushMaxDocumentSize(int maxDocumentSize) |
Sets a maximum size for documents from this point.
|
void |
reset() |
Resets this writer to the last
mark() saved. |
abortPipe, checkPreconditions, checkState, doWriteName, getName, getNextState, getState, isClosed, pipeExtraElements, setContext, setState, throwInvalidContextType, throwInvalidState, writeBinaryData, writeBinaryData, writeBoolean, writeBoolean, writeDateTime, writeDateTime, writeDBPointer, writeDBPointer, writeDecimal128, writeDecimal128, writeDouble, writeDouble, writeEndArray, writeEndDocument, writeInt32, writeInt32, writeInt64, writeInt64, writeJavaScript, writeJavaScript, writeJavaScriptWithScope, writeJavaScriptWithScope, writeMaxKey, writeMaxKey, writeMinKey, writeMinKey, writeName, writeNull, writeNull, writeObjectId, writeObjectId, writeRegularExpression, writeRegularExpression, writeStartArray, writeStartArray, writeStartDocument, writeStartDocument, writeString, writeString, writeSymbol, writeSymbol, writeTimestamp, writeTimestamp, writeUndefined, writeUndefined
public BsonBinaryWriter(BsonOutput bsonOutput, FieldNameValidator validator)
bsonOutput
- the output to write tovalidator
- the field name validator to applypublic BsonBinaryWriter(BsonOutput bsonOutput)
bsonOutput
- the output to write topublic BsonBinaryWriter(BsonWriterSettings settings, BsonBinaryWriterSettings binaryWriterSettings, BsonOutput bsonOutput)
settings
- the generic BsonWriter settingsbinaryWriterSettings
- the settings specific to a BsonBinaryWriterbsonOutput
- the output to write topublic BsonBinaryWriter(BsonWriterSettings settings, BsonBinaryWriterSettings binaryWriterSettings, BsonOutput bsonOutput, FieldNameValidator validator)
settings
- the generic BsonWriter settingsbinaryWriterSettings
- the settings specific to a BsonBinaryWriterbsonOutput
- the output to write tovalidator
- the field name validator to applypublic void close()
close
in interface AutoCloseable
close
in interface Closeable
close
in class AbstractBsonWriter
public BsonOutput getBsonOutput()
public BsonBinaryWriterSettings getBinaryWriterSettings()
public void flush()
BsonWriter
protected BsonBinaryWriter.Context getContext()
AbstractBsonWriter
getContext
in class AbstractBsonWriter
protected void doWriteStartDocument()
AbstractBsonWriter
doWriteStartDocument
in class AbstractBsonWriter
protected void doWriteEndDocument()
AbstractBsonWriter
doWriteEndDocument
in class AbstractBsonWriter
protected void doWriteStartArray()
AbstractBsonWriter
doWriteStartArray
in class AbstractBsonWriter
protected void doWriteEndArray()
AbstractBsonWriter
doWriteEndArray
in class AbstractBsonWriter
protected void doWriteBinaryData(BsonBinary value)
AbstractBsonWriter
BsonBinary
valuedoWriteBinaryData
in class AbstractBsonWriter
value
- the BsonBinary
value to writepublic void doWriteBoolean(boolean value)
AbstractBsonWriter
doWriteBoolean
in class AbstractBsonWriter
value
- the boolean
value to writeprotected void doWriteDateTime(long value)
AbstractBsonWriter
doWriteDateTime
in class AbstractBsonWriter
value
- the long
value to writeprotected void doWriteDBPointer(BsonDbPointer value)
AbstractBsonWriter
doWriteDBPointer
in class AbstractBsonWriter
value
- the BsonDbPointer
value to writeprotected void doWriteDouble(double value)
AbstractBsonWriter
doWriteDouble
in class AbstractBsonWriter
value
- the double
value to writeprotected void doWriteInt32(int value)
AbstractBsonWriter
doWriteInt32
in class AbstractBsonWriter
value
- the int
value to writeprotected void doWriteInt64(long value)
AbstractBsonWriter
doWriteInt64
in class AbstractBsonWriter
value
- the long
value to writeprotected void doWriteDecimal128(Decimal128 value)
AbstractBsonWriter
doWriteDecimal128
in class AbstractBsonWriter
value
- the Decimal128
value to writeprotected void doWriteJavaScript(String value)
AbstractBsonWriter
doWriteJavaScript
in class AbstractBsonWriter
value
- the String
value to writeprotected void doWriteJavaScriptWithScope(String value)
AbstractBsonWriter
doWriteJavaScriptWithScope
in class AbstractBsonWriter
value
- the boolean
value to writeprotected void doWriteMaxKey()
AbstractBsonWriter
doWriteMaxKey
in class AbstractBsonWriter
protected void doWriteMinKey()
AbstractBsonWriter
doWriteMinKey
in class AbstractBsonWriter
public void doWriteNull()
AbstractBsonWriter
doWriteNull
in class AbstractBsonWriter
public void doWriteObjectId(ObjectId value)
AbstractBsonWriter
doWriteObjectId
in class AbstractBsonWriter
value
- the ObjectId
value to writepublic void doWriteRegularExpression(BsonRegularExpression value)
AbstractBsonWriter
doWriteRegularExpression
in class AbstractBsonWriter
value
- the BsonRegularExpression
value to writepublic void doWriteString(String value)
AbstractBsonWriter
doWriteString
in class AbstractBsonWriter
value
- the String
value to writepublic void doWriteSymbol(String value)
AbstractBsonWriter
doWriteSymbol
in class AbstractBsonWriter
value
- the boolean
value to writepublic void doWriteTimestamp(BsonTimestamp value)
AbstractBsonWriter
doWriteTimestamp
in class AbstractBsonWriter
value
- the BsonTimestamp
value to writepublic void doWriteUndefined()
AbstractBsonWriter
doWriteUndefined
in class AbstractBsonWriter
public void pipe(BsonReader reader)
BsonWriter
pipe
in interface BsonWriter
pipe
in class AbstractBsonWriter
reader
- The source.public void pipe(BsonReader reader, List<BsonElement> extraElements)
AbstractBsonWriter
pipe
in class AbstractBsonWriter
reader
- the source of the documentextraElements
- the extra elements to append to the documentpublic void pushMaxDocumentSize(int maxDocumentSize)
maxDocumentSize
- the maximum document size.public void popMaxDocumentSize()
public void mark()
public void reset()
mark()
saved.IllegalStateException
- if mark()
was not called prior to reset.