Java 类org.bson.codecs.BsonDocumentCodec 实例源码

项目:mongo-java-driver-rx    文件:JsonPoweredTestHelper.java   
public static BsonDocument getTestDocument(final File file) throws IOException {
    return new BsonDocumentCodec().decode(new JsonReader(getFileAsString(file)), DecoderContext.builder().build());
}
项目:mongo-java-driver-reactivestreams    文件:JsonPoweredTestHelper.java   
public static BsonDocument getTestDocument(final File file) throws IOException {
    return new BsonDocumentCodec().decode(new JsonReader(getFileAsString(file)), DecoderContext.builder().build());
}
项目:immutables    文件:Jsons.java   
static JsonReader asGsonReader(BsonDocument bson) {
  BasicOutputBuffer output = new BasicOutputBuffer();
  new BsonDocumentCodec().encode(new BsonBinaryWriter(output), bson, EncoderContext.builder().build());
  return new BsonReader(new BsonBinaryReader(ByteBuffer.wrap(output.toByteArray())));
}
项目:immutables    文件:Jsons.java   
static BsonDocument toBson(JsonObject gson) throws IOException {
  return new BsonDocumentCodec().decode(asBsonReader(gson), DecoderContext.builder().build());
}
项目:vertx-native-mongo    文件:EncoderPerfTest.java   
@Benchmark
public Object encodeMongoTest() throws Exception {
    BasicOutputBuffer out = new BasicOutputBuffer(512);
    new BsonDocumentCodec().encode(new BsonBinaryWriter(out), doc1, EncoderContext.builder().build());
    return out.getByteBuffers();
}
项目:vertx-native-mongo    文件:EncoderPerfTest.java   
@Benchmark
public Object decodeMongoTest() throws Exception {
    BsonBinaryReader reader = new BsonBinaryReader(ByteBuffer.wrap(encoded));
    return new BsonDocumentCodec().decode(reader, DecoderContext.builder().build());
}