Package org.bson
Class LazyBSONCallback
- java.lang.Object
-
- org.bson.EmptyBSONCallback
-
- org.bson.LazyBSONCallback
-
- All Implemented Interfaces:
BSONCallback
- Direct Known Subclasses:
LazyDBCallback
public class LazyBSONCallback extends EmptyBSONCallback
ABSONCallbackfor creation ofLazyBSONObjectandLazyBSONListinstances.
-
-
Constructor Summary
Constructors Constructor Description LazyBSONCallback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListcreateArray(byte[] bytes, int offset)Create aLazyBSONListfrom the given bytes starting from the given offset.ObjectcreateDBRef(String ns, ObjectId id)This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).ObjectcreateObject(byte[] bytes, int offset)Create aLazyBSONObjectinstance from the given bytes starting from the given offset.Objectget()Returns the finished top-level Document.voidgotBinary(String name, byte type, byte[] data)Called when reading a field with aBsonType.BINARYvalue.voidreset()Resets the callback, clearing all state.-
Methods inherited from class org.bson.EmptyBSONCallback
arrayDone, arrayStart, arrayStart, createBSONCallback, gotBinaryArray, gotBoolean, gotCode, gotCodeWScope, gotDate, gotDBRef, gotDecimal128, gotDouble, gotInt, gotLong, gotMaxKey, gotMinKey, gotNull, gotObjectId, gotRegex, gotString, gotSymbol, gotTimestamp, gotUndefined, gotUUID, objectDone, objectStart, objectStart
-
-
-
-
Method Detail
-
reset
public void reset()
Description copied from interface:BSONCallbackResets the callback, clearing all state.- Specified by:
resetin interfaceBSONCallback- Overrides:
resetin classEmptyBSONCallback
-
get
public Object get()
Description copied from interface:BSONCallbackReturns the finished top-level Document.- Specified by:
getin interfaceBSONCallback- Overrides:
getin classEmptyBSONCallback- Returns:
- the top level document read from the database.
-
gotBinary
public void gotBinary(String name, byte type, byte[] data)
Description copied from interface:BSONCallbackCalled when reading a field with aBsonType.BINARYvalue. Note that binary values have a subtype, which may determine how the value is processed.- Specified by:
gotBinaryin interfaceBSONCallback- Overrides:
gotBinaryin classEmptyBSONCallback- Parameters:
name- the name of the fieldtype- one of the binary subtypes:BsonBinarySubTypedata- the field's value
-
createObject
public Object createObject(byte[] bytes, int offset)
Create aLazyBSONObjectinstance from the given bytes starting from the given offset.- Parameters:
bytes- the raw BSON bytesoffset- the offset into the bytes- Returns:
- the LazyBSONObject
-
createArray
public List createArray(byte[] bytes, int offset)
Create aLazyBSONListfrom the given bytes starting from the given offset.- Parameters:
bytes- the raw BSON bytesoffset- the offset into the bytes- Returns:
- the LazyBSONList
-
-