use of org.bson.RawBsonDocument in project mongo-java-driver by mongodb.
the class RawBsonDocumentCodec method decode.
@Override
public RawBsonDocument decode(final BsonReader reader, final DecoderContext decoderContext) {
BasicOutputBuffer buffer = new BasicOutputBuffer(0);
BsonBinaryWriter writer = new BsonBinaryWriter(buffer);
try {
writer.pipe(reader);
return new RawBsonDocument(buffer.getInternalBuffer(), 0, buffer.getPosition());
} finally {
writer.close();
buffer.close();
}
}
Aggregations