コード例 #1
0
  public Doc toObject(byte[] bytes) {
    BSONObject bo = new BSONObject(getTLS().getReadBuffer());

    try {
      return bo.deserialize(bytes);
    } catch (MongoDBException e) {
      throw new SerializationException(e);
    }
  }
コード例 #2
0
  public byte[] toBytes(Doc doc) {

    BSONObject bo = new BSONObject(getTLS().getWriteBuffer());

    try {
      bo.serialize(doc);
      return bo.toArray();
    } catch (MongoDBException e) {
      throw new SerializationException(e);
    }
  }