Package org.bson
Class LazyBSONCallback
java.lang.Object
org.bson.EmptyBSONCallback
org.bson.LazyBSONCallback
- All Implemented Interfaces:
BSONCallback
A
BSONCallback for creation of LazyBSONObject and LazyBSONList instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateArray(byte[] bytes, int offset) Create aLazyBSONListfrom the given bytes starting from the given offset.createDBRef(String ns, ObjectId id) This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).createObject(byte[] bytes, int offset) Create aLazyBSONObjectinstance from the given bytes starting from the given offset.get()Returns the finished top-level Document.voidCalled 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, gotBoolean, gotCode, gotCodeWScope, gotDate, gotDBRef, gotDecimal128, gotDouble, gotInt, gotLong, gotMaxKey, gotMinKey, gotNull, gotObjectId, gotRegex, gotString, gotSymbol, gotTimestamp, gotUndefined, gotUUID, objectDone, objectStart, objectStart
-
Constructor Details
-
LazyBSONCallback
public LazyBSONCallback()
-
-
Method Details
-
reset
public void reset()Description copied from interface:BSONCallbackResets the callback, clearing all state.- Specified by:
resetin interfaceBSONCallback- Overrides:
resetin classEmptyBSONCallback
-
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
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
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
Create aLazyBSONListfrom the given bytes starting from the given offset.- Parameters:
bytes- the raw BSON bytesoffset- the offset into the bytes- Returns:
- the LazyBSONList
-
createDBRef
This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).- Parameters:
ns- the namespace of the referenceid- the identifier of the reference- Returns:
- object to be used as reference representation
-