public Doc toObject(byte[] bytes) { BSONObject bo = new BSONObject(getTLS().getReadBuffer()); try { return bo.deserialize(bytes); } catch (MongoDBException e) { throw new SerializationException(e); } }
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); } }