Package org.bson
Class AbstractBsonReader
- java.lang.Object
- 
- org.bson.AbstractBsonReader
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- BsonReader
 - Direct Known Subclasses:
- BsonBinaryReader,- BsonDocumentReader,- JsonReader
 
 public abstract class AbstractBsonReader extends Object implements BsonReader Abstract base class for BsonReader implementations.- Since:
- 3.0
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classAbstractBsonReader.ContextThe context for the reader.protected classAbstractBsonReader.Markstatic classAbstractBsonReader.StateThe state of a reader.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractBsonReader()Initializes a new instance of the BsonReader class.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckPreconditions(String methodName, BsonType type)Ensures any conditions are met before reading commences.voidclose()Closes the reader.protected abstract intdoPeekBinarySize()Handles the logic to peek at the binary size.protected abstract bytedoPeekBinarySubType()Handles the logic to peek at the binary subtype.protected abstract BsonBinarydoReadBinaryData()Handles the logic to read binary dataprotected abstract booleandoReadBoolean()Handles the logic to read booleansprotected abstract longdoReadDateTime()Handles the logic to read date timeprotected abstract BsonDbPointerdoReadDBPointer()Handles the logic to read a DBPointerprotected abstract Decimal128doReadDecimal128()Handles the logic to read Decimal128protected abstract doubledoReadDouble()Handles the logic to read doublesprotected abstract voiddoReadEndArray()Handles the logic when reading the end of an arrayprotected abstract voiddoReadEndDocument()Handles the logic when reading the end of a documentprotected abstract intdoReadInt32()Handles the logic to read 32 bit intsprotected abstract longdoReadInt64()Handles the logic to read 64 bit intsprotected abstract StringdoReadJavaScript()Handles the logic to read Javascript functionsprotected abstract StringdoReadJavaScriptWithScope()Handles the logic to read scoped Javascript functionsprotected abstract voiddoReadMaxKey()Handles the logic to read a Max keyprotected abstract voiddoReadMinKey()Handles the logic to read a Min keyprotected abstract voiddoReadNull()Handles the logic to read a null valueprotected abstract ObjectIddoReadObjectId()Handles the logic to read an ObjectIdprotected abstract BsonRegularExpressiondoReadRegularExpression()Handles the logic to read a regular expressionprotected abstract voiddoReadStartArray()Handles the logic to read the start of an arrayprotected abstract voiddoReadStartDocument()Handles the logic to read the start of a documentprotected abstract StringdoReadString()Handles the logic to read a Stringprotected abstract StringdoReadSymbol()Handles the logic to read a Symbolprotected abstract BsonTimestampdoReadTimestamp()Handles the logic to read a timestampprotected abstract voiddoReadUndefined()Handles the logic to read an Undefined valueprotected abstract voiddoSkipName()Handles any logic required to skip the name (reader must be positioned on a name).protected abstract voiddoSkipValue()Handles any logic required to skip the value (reader must be positioned on a value).protected AbstractBsonReader.ContextgetContext()Get the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.BsonTypegetCurrentBsonType()StringgetCurrentName()Gets the most recently read name.protected AbstractBsonReader.StategetNextState()Returns the nextStateto transition to, based on theAbstractBsonReader.Contextof this reader.AbstractBsonReader.StategetState()protected booleanisClosed()Return true if the reader has been closed.intpeekBinarySize()Peeks the size of the binary data that the reader is positioned at.bytepeekBinarySubType()Peeks the subtype of the binary data that the reader is positioned at.BsonBinaryreadBinaryData()Reads BSON Binary data from the reader.BsonBinaryreadBinaryData(String name)Reads a BSON Binary data element from the reader.booleanreadBoolean()Reads a BSON Boolean from the reader.booleanreadBoolean(String name)Reads a BSON Boolean element from the reader.abstract BsonTypereadBsonType()Reads a BSONType from the reader.longreadDateTime()Reads a BSON DateTime from the reader.longreadDateTime(String name)Reads a BSON DateTime element from the reader.BsonDbPointerreadDBPointer()Reads a BSON DBPointer from the reader.BsonDbPointerreadDBPointer(String name)Reads a BSON DBPointer element from the reader.Decimal128readDecimal128()Reads a BSON Decimal128 from the reader.Decimal128readDecimal128(String name)Reads a BSON Decimal128 element from the reader.doublereadDouble()Reads a BSON Double from the reader.doublereadDouble(String name)Reads a BSON Double element from the reader.voidreadEndArray()Reads the end of a BSON array from the reader.voidreadEndDocument()Reads the end of a BSON document from the reader.intreadInt32()Reads a BSON Int32 from the reader.intreadInt32(String name)Reads a BSON Int32 element from the reader.longreadInt64()Reads a BSON Int64 from the reader.longreadInt64(String name)Reads a BSON Int64 element from the reader.StringreadJavaScript()Reads a BSON JavaScript from the reader.StringreadJavaScript(String name)Reads a BSON JavaScript element from the reader.StringreadJavaScriptWithScope()Reads a BSON JavaScript with scope from the reader (call readStartDocument next to read the scope).StringreadJavaScriptWithScope(String name)Reads a BSON JavaScript with scope element from the reader (call readStartDocument next to read the scope).voidreadMaxKey()Reads a BSON MaxKey from the reader.voidreadMaxKey(String name)Reads a BSON MaxKey element from the reader.voidreadMinKey()Reads a BSON MinKey from the reader.voidreadMinKey(String name)Reads a BSON MinKey element from the reader.StringreadName()Reads the name of an element from the reader.voidreadName(String name)Reads the name of an element from the reader.voidreadNull()Reads a BSON null from the reader.voidreadNull(String name)Reads a BSON null element from the reader.ObjectIdreadObjectId()Reads a BSON ObjectId from the reader.ObjectIdreadObjectId(String name)Reads a BSON ObjectId element from the reader.BsonRegularExpressionreadRegularExpression()Reads a BSON regular expression from the reader.BsonRegularExpressionreadRegularExpression(String name)Reads a BSON regular expression element from the reader.voidreadStartArray()Reads the start of a BSON array.voidreadStartDocument()Reads the start of a BSON document.StringreadString()Reads a BSON String from the reader.StringreadString(String name)Reads a BSON string element from the reader.StringreadSymbol()Reads a BSON symbol from the reader.StringreadSymbol(String name)Reads a BSON symbol element from the reader.BsonTimestampreadTimestamp()Reads a BSON timestamp from the reader.BsonTimestampreadTimestamp(String name)Reads a BSON timestamp element from the reader.voidreadUndefined()Reads a BSON undefined from the reader.voidreadUndefined(String name)Reads a BSON undefined element from the reader.protected voidsetContext(AbstractBsonReader.Context context)Set the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.protected voidsetCurrentBsonType(BsonType newType)Sets the type of the current value being read.protected voidsetCurrentName(String newName)Sets the field name for the key/value pair being read.protected voidsetState(AbstractBsonReader.State newState)Sets the new current state of this reader.voidskipName()Skips the name (reader must be positioned on a name).voidskipValue()Skips the value (reader must be positioned on a value).protected voidthrowInvalidContextType(String methodName, BsonContextType actualContextType, BsonContextType... validContextTypes)Throws an InvalidOperationException when the method called is not valid for the current ContextType.protected voidthrowInvalidState(String methodName, AbstractBsonReader.State... validStates)Throws an InvalidOperationException when the method called is not valid for the current state.protected voidverifyBSONType(String methodName, BsonType requiredBsonType)Verifies the current state and BSONType of the reader.protected voidverifyName(String expectedName)Verifies the name of the current element.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.bson.BsonReadergetMark, mark, reset
 
- 
 
- 
- 
- 
Method Detail- 
getCurrentBsonTypepublic BsonType getCurrentBsonType() - Specified by:
- getCurrentBsonTypein interface- BsonReader
- Returns:
- The current BsonType.
 
 - 
getCurrentNamepublic String getCurrentName() Description copied from interface:BsonReaderGets the most recently read name.- Specified by:
- getCurrentNamein interface- BsonReader
- Returns:
- the most recently read name
 
 - 
setCurrentBsonTypeprotected void setCurrentBsonType(BsonType newType) Sets the type of the current value being read.- Parameters:
- newType- the BSON Type.
 
 - 
getStatepublic AbstractBsonReader.State getState() - Returns:
- The current state of the reader.
 
 - 
setStateprotected void setState(AbstractBsonReader.State newState) Sets the new current state of this reader.- Parameters:
- newState- the state to set this reader to.
 
 - 
setCurrentNameprotected void setCurrentName(String newName) Sets the field name for the key/value pair being read.- Parameters:
- newName- the field name
 
 - 
closepublic void close() Closes the reader.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- BsonReader
- Specified by:
- closein interface- Closeable
 
 - 
isClosedprotected boolean isClosed() Return true if the reader has been closed.- Returns:
- true if closed
 
 - 
doReadBinaryDataprotected abstract BsonBinary doReadBinaryData() Handles the logic to read binary data- Returns:
- the BsonBinary value
 
 - 
doPeekBinarySubTypeprotected abstract byte doPeekBinarySubType() Handles the logic to peek at the binary subtype.- Returns:
- the binary subtype
 
 - 
doPeekBinarySizeprotected abstract int doPeekBinarySize() Handles the logic to peek at the binary size.- Returns:
- the binary size
- Since:
- 3.4
 
 - 
doReadBooleanprotected abstract boolean doReadBoolean() Handles the logic to read booleans- Returns:
- the boolean value
 
 - 
doReadDateTimeprotected abstract long doReadDateTime() Handles the logic to read date time- Returns:
- the long value
 
 - 
doReadDoubleprotected abstract double doReadDouble() Handles the logic to read doubles- Returns:
- the double value
 
 - 
doReadEndArrayprotected abstract void doReadEndArray() Handles the logic when reading the end of an array
 - 
doReadEndDocumentprotected abstract void doReadEndDocument() Handles the logic when reading the end of a document
 - 
doReadInt32protected abstract int doReadInt32() Handles the logic to read 32 bit ints- Returns:
- the int value
 
 - 
doReadInt64protected abstract long doReadInt64() Handles the logic to read 64 bit ints- Returns:
- the long value
 
 - 
doReadDecimal128protected abstract Decimal128 doReadDecimal128() Handles the logic to read Decimal128- Returns:
- the Decimal128 value
- Since:
- 3.4
 
 - 
doReadJavaScriptprotected abstract String doReadJavaScript() Handles the logic to read Javascript functions- Returns:
- the String value
 
 - 
doReadJavaScriptWithScopeprotected abstract String doReadJavaScriptWithScope() Handles the logic to read scoped Javascript functions- Returns:
- the String value
 
 - 
doReadMaxKeyprotected abstract void doReadMaxKey() Handles the logic to read a Max key
 - 
doReadMinKeyprotected abstract void doReadMinKey() Handles the logic to read a Min key
 - 
doReadNullprotected abstract void doReadNull() Handles the logic to read a null value
 - 
doReadObjectIdprotected abstract ObjectId doReadObjectId() Handles the logic to read an ObjectId- Returns:
- the ObjectId value
 
 - 
doReadRegularExpressionprotected abstract BsonRegularExpression doReadRegularExpression() Handles the logic to read a regular expression- Returns:
- the BsonRegularExpression value
 
 - 
doReadDBPointerprotected abstract BsonDbPointer doReadDBPointer() Handles the logic to read a DBPointer- Returns:
- the BsonDbPointer value
 
 - 
doReadStartArrayprotected abstract void doReadStartArray() Handles the logic to read the start of an array
 - 
doReadStartDocumentprotected abstract void doReadStartDocument() Handles the logic to read the start of a document
 - 
doReadStringprotected abstract String doReadString() Handles the logic to read a String- Returns:
- the String value
 
 - 
doReadSymbolprotected abstract String doReadSymbol() Handles the logic to read a Symbol- Returns:
- the String value
 
 - 
doReadTimestampprotected abstract BsonTimestamp doReadTimestamp() Handles the logic to read a timestamp- Returns:
- the BsonTimestamp value
 
 - 
doReadUndefinedprotected abstract void doReadUndefined() Handles the logic to read an Undefined value
 - 
doSkipNameprotected abstract void doSkipName() Handles any logic required to skip the name (reader must be positioned on a name).
 - 
doSkipValueprotected abstract void doSkipValue() Handles any logic required to skip the value (reader must be positioned on a value).
 - 
readBinaryDatapublic BsonBinary readBinaryData() Description copied from interface:BsonReaderReads BSON Binary data from the reader.- Specified by:
- readBinaryDatain interface- BsonReader
- Returns:
- A Binary.
 
 - 
peekBinarySubTypepublic byte peekBinarySubType() Description copied from interface:BsonReaderPeeks the subtype of the binary data that the reader is positioned at. This operation is not permitted if the mark is already set.- Specified by:
- peekBinarySubTypein interface- BsonReader
- Returns:
- the subtype
- See Also:
- BsonReader.mark()
 
 - 
peekBinarySizepublic int peekBinarySize() Description copied from interface:BsonReaderPeeks the size of the binary data that the reader is positioned at. This operation is not permitted if the mark is already set.- Specified by:
- peekBinarySizein interface- BsonReader
- Returns:
- the size of the binary data
- See Also:
- BsonReader.mark()
 
 - 
readBooleanpublic boolean readBoolean() Description copied from interface:BsonReaderReads a BSON Boolean from the reader.- Specified by:
- readBooleanin interface- BsonReader
- Returns:
- A Boolean.
 
 - 
readBsonTypepublic abstract BsonType readBsonType() Description copied from interface:BsonReaderReads a BSONType from the reader.- Specified by:
- readBsonTypein interface- BsonReader
- Returns:
- A BSONType.
 
 - 
readDateTimepublic long readDateTime() Description copied from interface:BsonReaderReads a BSON DateTime from the reader.- Specified by:
- readDateTimein interface- BsonReader
- Returns:
- The number of milliseconds since the Unix epoch.
 
 - 
readDoublepublic double readDouble() Description copied from interface:BsonReaderReads a BSON Double from the reader.- Specified by:
- readDoublein interface- BsonReader
- Returns:
- A Double.
 
 - 
readEndArraypublic void readEndArray() Description copied from interface:BsonReaderReads the end of a BSON array from the reader.- Specified by:
- readEndArrayin interface- BsonReader
 
 - 
readEndDocumentpublic void readEndDocument() Description copied from interface:BsonReaderReads the end of a BSON document from the reader.- Specified by:
- readEndDocumentin interface- BsonReader
 
 - 
readInt32public int readInt32() Description copied from interface:BsonReaderReads a BSON Int32 from the reader.- Specified by:
- readInt32in interface- BsonReader
- Returns:
- An Int32.
 
 - 
readInt64public long readInt64() Description copied from interface:BsonReaderReads a BSON Int64 from the reader.- Specified by:
- readInt64in interface- BsonReader
- Returns:
- An Int64.
 
 - 
readDecimal128public Decimal128 readDecimal128() Description copied from interface:BsonReaderReads a BSON Decimal128 from the reader.- Specified by:
- readDecimal128in interface- BsonReader
- Returns:
- A Decimal128
 
 - 
readJavaScriptpublic String readJavaScript() Description copied from interface:BsonReaderReads a BSON JavaScript from the reader.- Specified by:
- readJavaScriptin interface- BsonReader
- Returns:
- A string.
 
 - 
readJavaScriptWithScopepublic String readJavaScriptWithScope() Description copied from interface:BsonReaderReads a BSON JavaScript with scope from the reader (call readStartDocument next to read the scope).- Specified by:
- readJavaScriptWithScopein interface- BsonReader
- Returns:
- A string.
 
 - 
readMaxKeypublic void readMaxKey() Description copied from interface:BsonReaderReads a BSON MaxKey from the reader.- Specified by:
- readMaxKeyin interface- BsonReader
 
 - 
readMinKeypublic void readMinKey() Description copied from interface:BsonReaderReads a BSON MinKey from the reader.- Specified by:
- readMinKeyin interface- BsonReader
 
 - 
readNullpublic void readNull() Description copied from interface:BsonReaderReads a BSON null from the reader.- Specified by:
- readNullin interface- BsonReader
 
 - 
readObjectIdpublic ObjectId readObjectId() Description copied from interface:BsonReaderReads a BSON ObjectId from the reader.- Specified by:
- readObjectIdin interface- BsonReader
- Returns:
- the ObjectIdvalue
 
 - 
readRegularExpressionpublic BsonRegularExpression readRegularExpression() Description copied from interface:BsonReaderReads a BSON regular expression from the reader.- Specified by:
- readRegularExpressionin interface- BsonReader
- Returns:
- A regular expression.
 
 - 
readDBPointerpublic BsonDbPointer readDBPointer() Description copied from interface:BsonReaderReads a BSON DBPointer from the reader.- Specified by:
- readDBPointerin interface- BsonReader
- Returns:
- A DBPointer.
 
 - 
readStartArraypublic void readStartArray() Description copied from interface:BsonReaderReads the start of a BSON array.- Specified by:
- readStartArrayin interface- BsonReader
 
 - 
readStartDocumentpublic void readStartDocument() Description copied from interface:BsonReaderReads the start of a BSON document.- Specified by:
- readStartDocumentin interface- BsonReader
 
 - 
readStringpublic String readString() Description copied from interface:BsonReaderReads a BSON String from the reader.- Specified by:
- readStringin interface- BsonReader
- Returns:
- A String.
 
 - 
readSymbolpublic String readSymbol() Description copied from interface:BsonReaderReads a BSON symbol from the reader.- Specified by:
- readSymbolin interface- BsonReader
- Returns:
- A string.
 
 - 
readTimestamppublic BsonTimestamp readTimestamp() Description copied from interface:BsonReaderReads a BSON timestamp from the reader.- Specified by:
- readTimestampin interface- BsonReader
- Returns:
- The combined timestamp/increment.
 
 - 
readUndefinedpublic void readUndefined() Description copied from interface:BsonReaderReads a BSON undefined from the reader.- Specified by:
- readUndefinedin interface- BsonReader
 
 - 
skipNamepublic void skipName() Description copied from interface:BsonReaderSkips the name (reader must be positioned on a name).- Specified by:
- skipNamein interface- BsonReader
 
 - 
skipValuepublic void skipValue() Description copied from interface:BsonReaderSkips the value (reader must be positioned on a value).- Specified by:
- skipValuein interface- BsonReader
 
 - 
readBinaryDatapublic BsonBinary readBinaryData(String name) Description copied from interface:BsonReaderReads a BSON Binary data element from the reader.- Specified by:
- readBinaryDatain interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A Binary.
 
 - 
readBooleanpublic boolean readBoolean(String name) Description copied from interface:BsonReaderReads a BSON Boolean element from the reader.- Specified by:
- readBooleanin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A Boolean.
 
 - 
readDateTimepublic long readDateTime(String name) Description copied from interface:BsonReaderReads a BSON DateTime element from the reader.- Specified by:
- readDateTimein interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- The number of milliseconds since the Unix epoch.
 
 - 
readDoublepublic double readDouble(String name) Description copied from interface:BsonReaderReads a BSON Double element from the reader.- Specified by:
- readDoublein interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A Double.
 
 - 
readInt32public int readInt32(String name) Description copied from interface:BsonReaderReads a BSON Int32 element from the reader.- Specified by:
- readInt32in interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- An Int32.
 
 - 
readInt64public long readInt64(String name) Description copied from interface:BsonReaderReads a BSON Int64 element from the reader.- Specified by:
- readInt64in interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- An Int64.
 
 - 
readDecimal128public Decimal128 readDecimal128(String name) Description copied from interface:BsonReaderReads a BSON Decimal128 element from the reader.- Specified by:
- readDecimal128in interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A Decimal128
 
 - 
readJavaScriptpublic String readJavaScript(String name) Description copied from interface:BsonReaderReads a BSON JavaScript element from the reader.- Specified by:
- readJavaScriptin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A string.
 
 - 
readJavaScriptWithScopepublic String readJavaScriptWithScope(String name) Description copied from interface:BsonReaderReads a BSON JavaScript with scope element from the reader (call readStartDocument next to read the scope).- Specified by:
- readJavaScriptWithScopein interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A string.
 
 - 
readMaxKeypublic void readMaxKey(String name) Description copied from interface:BsonReaderReads a BSON MaxKey element from the reader.- Specified by:
- readMaxKeyin interface- BsonReader
- Parameters:
- name- The name of the element.
 
 - 
readMinKeypublic void readMinKey(String name) Description copied from interface:BsonReaderReads a BSON MinKey element from the reader.- Specified by:
- readMinKeyin interface- BsonReader
- Parameters:
- name- The name of the element.
 
 - 
readNamepublic String readName() Description copied from interface:BsonReaderReads the name of an element from the reader.- Specified by:
- readNamein interface- BsonReader
- Returns:
- The name of the element.
 
 - 
readNamepublic void readName(String name) Description copied from interface:BsonReaderReads the name of an element from the reader.- Specified by:
- readNamein interface- BsonReader
- Parameters:
- name- The name of the element.
 
 - 
readNullpublic void readNull(String name) Description copied from interface:BsonReaderReads a BSON null element from the reader.- Specified by:
- readNullin interface- BsonReader
- Parameters:
- name- The name of the element.
 
 - 
readObjectIdpublic ObjectId readObjectId(String name) Description copied from interface:BsonReaderReads a BSON ObjectId element from the reader.- Specified by:
- readObjectIdin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- ObjectId.
 
 - 
readRegularExpressionpublic BsonRegularExpression readRegularExpression(String name) Description copied from interface:BsonReaderReads a BSON regular expression element from the reader.- Specified by:
- readRegularExpressionin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A regular expression.
 
 - 
readDBPointerpublic BsonDbPointer readDBPointer(String name) Description copied from interface:BsonReaderReads a BSON DBPointer element from the reader.- Specified by:
- readDBPointerin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A DBPointer.
 
 - 
readStringpublic String readString(String name) Description copied from interface:BsonReaderReads a BSON string element from the reader.- Specified by:
- readStringin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A String.
 
 - 
readSymbolpublic String readSymbol(String name) Description copied from interface:BsonReaderReads a BSON symbol element from the reader.- Specified by:
- readSymbolin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- A string.
 
 - 
readTimestamppublic BsonTimestamp readTimestamp(String name) Description copied from interface:BsonReaderReads a BSON timestamp element from the reader.- Specified by:
- readTimestampin interface- BsonReader
- Parameters:
- name- The name of the element.
- Returns:
- The combined timestamp/increment.
 
 - 
readUndefinedpublic void readUndefined(String name) Description copied from interface:BsonReaderReads a BSON undefined element from the reader.- Specified by:
- readUndefinedin interface- BsonReader
- Parameters:
- name- The name of the element.
 
 - 
throwInvalidContextTypeprotected void throwInvalidContextType(String methodName, BsonContextType actualContextType, BsonContextType... validContextTypes) Throws an InvalidOperationException when the method called is not valid for the current ContextType.- Parameters:
- methodName- The name of the method.
- actualContextType- The actual ContextType.
- validContextTypes- The valid ContextTypes.
- Throws:
- BsonInvalidOperationException- when the method called is not valid for the current ContextType.
 
 - 
throwInvalidStateprotected void throwInvalidState(String methodName, AbstractBsonReader.State... validStates) Throws an InvalidOperationException when the method called is not valid for the current state.- Parameters:
- methodName- The name of the method.
- validStates- The valid states.
- Throws:
- BsonInvalidOperationException- when the method called is not valid for the current state.
 
 - 
verifyBSONTypeprotected void verifyBSONType(String methodName, BsonType requiredBsonType) Verifies the current state and BSONType of the reader.- Parameters:
- methodName- The name of the method calling this one.
- requiredBsonType- The required BSON type.
 
 - 
verifyNameprotected void verifyName(String expectedName) Verifies the name of the current element.- Parameters:
- expectedName- The expected name.
- Throws:
- BsonSerializationException- when the name read is not the expected name
 
 - 
checkPreconditionsprotected void checkPreconditions(String methodName, BsonType type) Ensures any conditions are met before reading commences. Throws exceptions if the conditions are not met.- Parameters:
- methodName- the name of the current method, which will indicate the field being read
- type- the type of this field
 
 - 
getContextprotected AbstractBsonReader.Context getContext() Get the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.- Returns:
- the context
 
 - 
setContextprotected void setContext(AbstractBsonReader.Context context) Set the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.- Parameters:
- context- the current context.
 
 - 
getNextStateprotected AbstractBsonReader.State getNextState() Returns the nextStateto transition to, based on theAbstractBsonReader.Contextof this reader.- Returns:
- the next state
 
 
- 
 
-