Package org.bson
Class BsonDocumentReader
- java.lang.Object
- 
- org.bson.AbstractBsonReader
- 
- org.bson.BsonDocumentReader
 
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- BsonReader
 
 public class BsonDocumentReader extends AbstractBsonReader ABsonReaderimplementation that reads from an instance ofBsonDocument. This can be used to decode aBsonDocumentusing aDecoder.- Since:
- 3.0
- See Also:
- BsonDocument,- Decoder
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classBsonDocumentReader.Contextprotected classBsonDocumentReader.Mark- 
Nested classes/interfaces inherited from class org.bson.AbstractBsonReaderAbstractBsonReader.State
 
- 
 - 
Constructor SummaryConstructors Constructor Description BsonDocumentReader(BsonDocument document)Construct a new instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intdoPeekBinarySize()Handles the logic to peek at the binary size.protected bytedoPeekBinarySubType()Handles the logic to peek at the binary subtype.protected BsonBinarydoReadBinaryData()Handles the logic to read binary dataprotected booleandoReadBoolean()Handles the logic to read booleansprotected longdoReadDateTime()Handles the logic to read date timeprotected BsonDbPointerdoReadDBPointer()Handles the logic to read a DBPointerDecimal128doReadDecimal128()Handles the logic to read Decimal128protected doubledoReadDouble()Handles the logic to read doublesprotected voiddoReadEndArray()Handles the logic when reading the end of an arrayprotected voiddoReadEndDocument()Handles the logic when reading the end of a documentprotected intdoReadInt32()Handles the logic to read 32 bit intsprotected longdoReadInt64()Handles the logic to read 64 bit intsprotected StringdoReadJavaScript()Handles the logic to read Javascript functionsprotected StringdoReadJavaScriptWithScope()Handles the logic to read scoped Javascript functionsprotected voiddoReadMaxKey()Handles the logic to read a Max keyprotected voiddoReadMinKey()Handles the logic to read a Min keyprotected voiddoReadNull()Handles the logic to read a null valueprotected ObjectIddoReadObjectId()Handles the logic to read an ObjectIdprotected BsonRegularExpressiondoReadRegularExpression()Handles the logic to read a regular expressionprotected voiddoReadStartArray()Handles the logic to read the start of an arrayprotected voiddoReadStartDocument()Handles the logic to read the start of a documentprotected StringdoReadString()Handles the logic to read a Stringprotected StringdoReadSymbol()Handles the logic to read a Symbolprotected BsonTimestampdoReadTimestamp()Handles the logic to read a timestampprotected voiddoReadUndefined()Handles the logic to read an Undefined valueprotected voiddoSkipName()Handles any logic required to skip the name (reader must be positioned on a name).protected voiddoSkipValue()Handles any logic required to skip the value (reader must be positioned on a value).protected BsonDocumentReader.ContextgetContext()Get the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.BsonReaderMarkgetMark()Gets a mark representing the current state of the reader.BsonTypereadBsonType()Reads a BSONType from the reader.- 
Methods inherited from class org.bson.AbstractBsonReadercheckPreconditions, close, getCurrentBsonType, getCurrentName, getNextState, getState, isClosed, peekBinarySize, peekBinarySubType, readBinaryData, readBinaryData, readBoolean, readBoolean, readDateTime, readDateTime, readDBPointer, readDBPointer, readDecimal128, readDecimal128, readDouble, readDouble, readEndArray, readEndDocument, readInt32, readInt32, readInt64, readInt64, readJavaScript, readJavaScript, readJavaScriptWithScope, readJavaScriptWithScope, readMaxKey, readMaxKey, readMinKey, readMinKey, readName, readName, readNull, readNull, readObjectId, readObjectId, readRegularExpression, readRegularExpression, readStartArray, readStartDocument, readString, readString, readSymbol, readSymbol, readTimestamp, readTimestamp, readUndefined, readUndefined, setContext, setCurrentBsonType, setCurrentName, setState, skipName, skipValue, throwInvalidContextType, throwInvalidState, verifyBSONType, verifyName
 
- 
 
- 
- 
- 
Constructor Detail- 
BsonDocumentReaderpublic BsonDocumentReader(BsonDocument document) Construct a new instance.- Parameters:
- document- the document to read from
 
 
- 
 - 
Method Detail- 
doReadBinaryDataprotected BsonBinary doReadBinaryData() Description copied from class:AbstractBsonReaderHandles the logic to read binary data- Specified by:
- doReadBinaryDatain class- AbstractBsonReader
- Returns:
- the BsonBinary value
 
 - 
doPeekBinarySubTypeprotected byte doPeekBinarySubType() Description copied from class:AbstractBsonReaderHandles the logic to peek at the binary subtype.- Specified by:
- doPeekBinarySubTypein class- AbstractBsonReader
- Returns:
- the binary subtype
 
 - 
doPeekBinarySizeprotected int doPeekBinarySize() Description copied from class:AbstractBsonReaderHandles the logic to peek at the binary size.- Specified by:
- doPeekBinarySizein class- AbstractBsonReader
- Returns:
- the binary size
 
 - 
doReadBooleanprotected boolean doReadBoolean() Description copied from class:AbstractBsonReaderHandles the logic to read booleans- Specified by:
- doReadBooleanin class- AbstractBsonReader
- Returns:
- the boolean value
 
 - 
doReadDateTimeprotected long doReadDateTime() Description copied from class:AbstractBsonReaderHandles the logic to read date time- Specified by:
- doReadDateTimein class- AbstractBsonReader
- Returns:
- the long value
 
 - 
doReadDoubleprotected double doReadDouble() Description copied from class:AbstractBsonReaderHandles the logic to read doubles- Specified by:
- doReadDoublein class- AbstractBsonReader
- Returns:
- the double value
 
 - 
doReadEndArrayprotected void doReadEndArray() Description copied from class:AbstractBsonReaderHandles the logic when reading the end of an array- Specified by:
- doReadEndArrayin class- AbstractBsonReader
 
 - 
doReadEndDocumentprotected void doReadEndDocument() Description copied from class:AbstractBsonReaderHandles the logic when reading the end of a document- Specified by:
- doReadEndDocumentin class- AbstractBsonReader
 
 - 
doReadInt32protected int doReadInt32() Description copied from class:AbstractBsonReaderHandles the logic to read 32 bit ints- Specified by:
- doReadInt32in class- AbstractBsonReader
- Returns:
- the int value
 
 - 
doReadInt64protected long doReadInt64() Description copied from class:AbstractBsonReaderHandles the logic to read 64 bit ints- Specified by:
- doReadInt64in class- AbstractBsonReader
- Returns:
- the long value
 
 - 
doReadDecimal128public Decimal128 doReadDecimal128() Description copied from class:AbstractBsonReaderHandles the logic to read Decimal128- Specified by:
- doReadDecimal128in class- AbstractBsonReader
- Returns:
- the Decimal128 value
 
 - 
doReadJavaScriptprotected String doReadJavaScript() Description copied from class:AbstractBsonReaderHandles the logic to read Javascript functions- Specified by:
- doReadJavaScriptin class- AbstractBsonReader
- Returns:
- the String value
 
 - 
doReadJavaScriptWithScopeprotected String doReadJavaScriptWithScope() Description copied from class:AbstractBsonReaderHandles the logic to read scoped Javascript functions- Specified by:
- doReadJavaScriptWithScopein class- AbstractBsonReader
- Returns:
- the String value
 
 - 
doReadMaxKeyprotected void doReadMaxKey() Description copied from class:AbstractBsonReaderHandles the logic to read a Max key- Specified by:
- doReadMaxKeyin class- AbstractBsonReader
 
 - 
doReadMinKeyprotected void doReadMinKey() Description copied from class:AbstractBsonReaderHandles the logic to read a Min key- Specified by:
- doReadMinKeyin class- AbstractBsonReader
 
 - 
doReadNullprotected void doReadNull() Description copied from class:AbstractBsonReaderHandles the logic to read a null value- Specified by:
- doReadNullin class- AbstractBsonReader
 
 - 
doReadObjectIdprotected ObjectId doReadObjectId() Description copied from class:AbstractBsonReaderHandles the logic to read an ObjectId- Specified by:
- doReadObjectIdin class- AbstractBsonReader
- Returns:
- the ObjectId value
 
 - 
doReadRegularExpressionprotected BsonRegularExpression doReadRegularExpression() Description copied from class:AbstractBsonReaderHandles the logic to read a regular expression- Specified by:
- doReadRegularExpressionin class- AbstractBsonReader
- Returns:
- the BsonRegularExpression value
 
 - 
doReadDBPointerprotected BsonDbPointer doReadDBPointer() Description copied from class:AbstractBsonReaderHandles the logic to read a DBPointer- Specified by:
- doReadDBPointerin class- AbstractBsonReader
- Returns:
- the BsonDbPointer value
 
 - 
doReadStartArrayprotected void doReadStartArray() Description copied from class:AbstractBsonReaderHandles the logic to read the start of an array- Specified by:
- doReadStartArrayin class- AbstractBsonReader
 
 - 
doReadStartDocumentprotected void doReadStartDocument() Description copied from class:AbstractBsonReaderHandles the logic to read the start of a document- Specified by:
- doReadStartDocumentin class- AbstractBsonReader
 
 - 
doReadStringprotected String doReadString() Description copied from class:AbstractBsonReaderHandles the logic to read a String- Specified by:
- doReadStringin class- AbstractBsonReader
- Returns:
- the String value
 
 - 
doReadSymbolprotected String doReadSymbol() Description copied from class:AbstractBsonReaderHandles the logic to read a Symbol- Specified by:
- doReadSymbolin class- AbstractBsonReader
- Returns:
- the String value
 
 - 
doReadTimestampprotected BsonTimestamp doReadTimestamp() Description copied from class:AbstractBsonReaderHandles the logic to read a timestamp- Specified by:
- doReadTimestampin class- AbstractBsonReader
- Returns:
- the BsonTimestamp value
 
 - 
doReadUndefinedprotected void doReadUndefined() Description copied from class:AbstractBsonReaderHandles the logic to read an Undefined value- Specified by:
- doReadUndefinedin class- AbstractBsonReader
 
 - 
doSkipNameprotected void doSkipName() Description copied from class:AbstractBsonReaderHandles any logic required to skip the name (reader must be positioned on a name).- Specified by:
- doSkipNamein class- AbstractBsonReader
 
 - 
doSkipValueprotected void doSkipValue() Description copied from class:AbstractBsonReaderHandles any logic required to skip the value (reader must be positioned on a value).- Specified by:
- doSkipValuein class- AbstractBsonReader
 
 - 
readBsonTypepublic BsonType readBsonType() Description copied from interface:BsonReaderReads a BSONType from the reader.- Specified by:
- readBsonTypein interface- BsonReader
- Specified by:
- readBsonTypein class- AbstractBsonReader
- Returns:
- A BSONType.
 
 - 
getMarkpublic BsonReaderMark getMark() Description copied from interface:BsonReaderGets a mark representing the current state of the reader.- Returns:
- the mark
 
 - 
getContextprotected BsonDocumentReader.Context getContext() Description copied from class:AbstractBsonReaderGet the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.- Overrides:
- getContextin class- AbstractBsonReader
- Returns:
- the context
 
 
- 
 
-