use of org.bson.BsonWriterSettings in project mongo-java-driver by mongodb.
the class BaseWriteCommandMessage method encodeMessageBodyWithMetadata.
@Override
protected EncodingMetadata encodeMessageBodyWithMetadata(final BsonOutput outputStream, final int messageStartPosition) {
BaseWriteCommandMessage nextMessage = null;
writeCommandHeader(outputStream);
int commandStartPosition = outputStream.getPosition();
int firstDocumentStartPosition = outputStream.getPosition();
BsonBinaryWriter writer = new BsonBinaryWriter(new BsonWriterSettings(), new BsonBinaryWriterSettings(getSettings().getMaxDocumentSize() + HEADROOM), outputStream, getFieldNameValidator());
try {
writer.writeStartDocument();
writeCommandPrologue(writer);
nextMessage = writeTheWrites(outputStream, commandStartPosition, writer);
writer.writeEndDocument();
} finally {
writer.close();
}
return new EncodingMetadata(nextMessage, firstDocumentStartPosition);
}
Aggregations