List of usage examples for com.mongodb.util JSONCallback get
@Override
public Object get()
From source file:de.inovex.andsync.util.BsonConverter.java
License:Apache License
public static DBObject fromBson(byte[] bson) { JSONCallback callback = new JSONCallback(); try {//from w ww .j a v a 2 s . c o m decoderPool.get().decode(bson, callback); } catch (Exception ex) { Log.e("Data was not a valid BSON object."); return null; } return (DBObject) callback.get(); }
From source file:de.inovex.andsync.util.BsonConverter.java
License:Apache License
public static List<DBObject> fromBsonList(byte[] bson) { JSONCallback callback = new JSONCallback(); try {/*from w ww . j a v a 2 s .c o m*/ decoderPool.get().decode(bson, callback); //new BasicBSONDecoder().decode(bson, callback); } catch (Exception ex) { Log.w("Data was not a valid BSON object."); return null; } BasicDBObject dbo = (BasicDBObject) callback.get(); List<DBObject> list = new ArrayList<DBObject>(dbo.size()); for (Object o : dbo.values()) { list.add((DBObject) o); } return list; }