Java可扩展的BSON编码和解码器:ebson
jopen
9年前
一个采用Java开发,可扩展的BSON编码和解码器,拥有一个可拔插的 Java-to-BSON 类型映射。
</div> Maven:
<dependency> <groupId>com.github.kohanyirobert</groupId> <artifactId>ebson</artifactId> <version>...</version> </dependency>
示例代码:
// create documents to serialize BsonDocument document = BsonDocuments.of("key", new Date()); // grab a little-endian byte buffer ByteBuffer buffer = ByteBuffer.allocate(32).order(ByteOrder.LITTLE_ENDIAN); // use the documents utility class to write the document into the buffer BsonDocuments.writeTo(buffer, document); // use the serialized data buffer.flip();