public abstract class AbstractBsonReader extends java.lang.Object implements java.io.Closeable, BsonReader
| 限定符和类型 | 类和说明 |
|---|---|
protected class |
AbstractBsonReader.Context
The context for the reader.
|
protected class |
AbstractBsonReader.Mark |
static class |
AbstractBsonReader.State
The state of a reader.
|
| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractBsonReader()
Initializes a new instance of the BsonReader class.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
checkPreconditions(java.lang.String methodName,
BsonType type)
Ensures any conditions are met before reading commences.
|
void |
close()
Closes the reader.
|
protected abstract byte |
doPeekBinarySubType()
Handles the logic to peek at the binary subtype.
|
protected abstract BsonBinary |
doReadBinaryData()
Handles the logic to read binary data
|
protected abstract boolean |
doReadBoolean()
Handles the logic to read booleans
|
protected abstract long |
doReadDateTime()
Handles the logic to read date time
|
protected abstract BsonDbPointer |
doReadDBPointer()
Handles the logic to read a DBPointer
|
protected abstract double |
doReadDouble()
Handles the logic to read doubles
|
protected abstract void |
doReadEndArray()
Handles the logic when reading the end of an array
|
protected abstract void |
doReadEndDocument()
Handles the logic when reading the end of a document
|
protected abstract int |
doReadInt32()
Handles the logic to read 32 bit ints
|
protected abstract long |
doReadInt64()
Handles the logic to read 64 bit ints
|
protected abstract java.lang.String |
doReadJavaScript()
Handles the logic to read Javascript functions
|
protected abstract java.lang.String |
doReadJavaScriptWithScope()
Handles the logic to read scoped Javascript functions
|
protected abstract void |
doReadMaxKey()
Handles the logic to read a Max key
|
protected abstract void |
doReadMinKey()
Handles the logic to read a Min key
|
protected abstract void |
doReadNull()
Handles the logic to read a null value
|
protected abstract ObjectId |
doReadObjectId()
Handles the logic to read an ObjectId
|
protected abstract BsonRegularExpression |
doReadRegularExpression()
Handles the logic to read a regular expression
|
protected abstract void |
doReadStartArray()
Handles the logic to read the start of an array
|
protected abstract void |
doReadStartDocument()
Handles the logic to read the start of a document
|
protected abstract java.lang.String |
doReadString()
Handles the logic to read a String
|
protected abstract java.lang.String |
doReadSymbol()
Handles the logic to read a Symbol
|
protected abstract BsonTimestamp |
doReadTimestamp()
Handles the logic to read a timestamp
|
protected abstract void |
doReadUndefined()
Handles the logic to read an Undefined value
|
protected abstract void |
doSkipName()
Handles any logic required to skip the name (reader must be positioned on a name).
|
protected abstract void |
doSkipValue()
Handles any logic required to skip the value (reader must be positioned on a value).
|
protected 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.
|
BsonType |
getCurrentBsonType() |
java.lang.String |
getCurrentName()
Gets the most recently read name.
|
protected AbstractBsonReader.State |
getNextState()
Returns the next
State to transition to, based on the AbstractBsonReader.Context of this reader. |
AbstractBsonReader.State |
getState() |
protected boolean |
isClosed()
Return true if the reader has been closed.
|
byte |
peekBinarySubType()
Peeks the subtype of the binary data that the reader is positioned at.
|
BsonBinary |
readBinaryData()
Reads BSON Binary data from the reader.
|
BsonBinary |
readBinaryData(java.lang.String name)
Reads a BSON Binary data element from the reader.
|
boolean |
readBoolean()
Reads a BSON Boolean from the reader.
|
boolean |
readBoolean(java.lang.String name)
Reads a BSON Boolean element from the reader.
|
abstract BsonType |
readBsonType()
Reads a BSONType from the reader.
|
long |
readDateTime()
Reads a BSON DateTime from the reader.
|
long |
readDateTime(java.lang.String name)
Reads a BSON DateTime element from the reader.
|
BsonDbPointer |
readDBPointer()
Reads a BSON DBPointer from the reader.
|
BsonDbPointer |
readDBPointer(java.lang.String name)
Reads a BSON DBPointer element from the reader.
|
double |
readDouble()
Reads a BSON Double from the reader.
|
double |
readDouble(java.lang.String name)
Reads a BSON Double element from the reader.
|
void |
readEndArray()
Reads the end of a BSON array from the reader.
|
void |
readEndDocument()
Reads the end of a BSON document from the reader.
|
int |
readInt32()
Reads a BSON Int32 from the reader.
|
int |
readInt32(java.lang.String name)
Reads a BSON Int32 element from the reader.
|
long |
readInt64()
Reads a BSON Int64 from the reader.
|
long |
readInt64(java.lang.String name)
Reads a BSON Int64 element from the reader.
|
java.lang.String |
readJavaScript()
Reads a BSON JavaScript from the reader.
|
java.lang.String |
readJavaScript(java.lang.String name)
Reads a BSON JavaScript element from the reader.
|
java.lang.String |
readJavaScriptWithScope()
Reads a BSON JavaScript with scope from the reader (call readStartDocument next to read the scope).
|
java.lang.String |
readJavaScriptWithScope(java.lang.String name)
Reads a BSON JavaScript with scope element from the reader (call readStartDocument next to read the scope).
|
void |
readMaxKey()
Reads a BSON MaxKey from the reader.
|
void |
readMaxKey(java.lang.String name)
Reads a BSON MaxKey element from the reader.
|
void |
readMinKey()
Reads a BSON MinKey from the reader.
|
void |
readMinKey(java.lang.String name)
Reads a BSON MinKey element from the reader.
|
java.lang.String |
readName()
Reads the name of an element from the reader.
|
void |
readName(java.lang.String name)
Reads the name of an element from the reader.
|
void |
readNull()
Reads a BSON null from the reader.
|
void |
readNull(java.lang.String name)
Reads a BSON null element from the reader.
|
ObjectId |
readObjectId()
Reads a BSON ObjectId from the reader.
|
ObjectId |
readObjectId(java.lang.String name)
Reads a BSON ObjectId element from the reader.
|
BsonRegularExpression |
readRegularExpression()
Reads a BSON regular expression from the reader.
|
BsonRegularExpression |
readRegularExpression(java.lang.String name)
Reads a BSON regular expression element from the reader.
|
void |
readStartArray()
Reads the start of a BSON array.
|
void |
readStartDocument()
Reads the start of a BSON document.
|
java.lang.String |
readString()
Reads a BSON String from the reader.
|
java.lang.String |
readString(java.lang.String name)
Reads a BSON string element from the reader.
|
java.lang.String |
readSymbol()
Reads a BSON symbol from the reader.
|
java.lang.String |
readSymbol(java.lang.String name)
Reads a BSON symbol element from the reader.
|
BsonTimestamp |
readTimestamp()
Reads a BSON timestamp from the reader.
|
BsonTimestamp |
readTimestamp(java.lang.String name)
Reads a BSON timestamp element from the reader.
|
void |
readUndefined()
Reads a BSON undefined from the reader.
|
void |
readUndefined(java.lang.String name)
Reads a BSON undefined element from the reader.
|
protected 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.
|
protected void |
setCurrentBsonType(BsonType newType)
Sets the type of the current value being read.
|
protected void |
setCurrentName(java.lang.String newName)
Sets the field name for the key/value pair being read.
|
protected void |
setState(AbstractBsonReader.State newState)
Sets the new current state of this reader.
|
void |
skipName()
Skips the name (reader must be positioned on a name).
|
void |
skipValue()
Skips the value (reader must be positioned on a value).
|
protected void |
throwInvalidContextType(java.lang.String methodName,
BsonContextType actualContextType,
BsonContextType... validContextTypes)
Throws an InvalidOperationException when the method called is not valid for the current ContextType.
|
protected void |
throwInvalidState(java.lang.String methodName,
AbstractBsonReader.State... validStates)
Throws an InvalidOperationException when the method called is not valid for the current state.
|
protected void |
verifyBSONType(java.lang.String methodName,
BsonType requiredBsonType)
Verifies the current state and BSONType of the reader.
|
protected void |
verifyName(java.lang.String expectedName)
Verifies the name of the current element.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmark, resetprotected AbstractBsonReader()
public BsonType getCurrentBsonType()
getCurrentBsonType 在接口中 BsonReaderpublic java.lang.String getCurrentName()
BsonReadergetCurrentName 在接口中 BsonReaderprotected void setCurrentBsonType(BsonType newType)
newType - the BSON Type.public AbstractBsonReader.State getState()
protected void setState(AbstractBsonReader.State newState)
newState - the state to set this reader to.protected void setCurrentName(java.lang.String newName)
newName - the field namepublic void close()
close 在接口中 java.io.Closeableclose 在接口中 java.lang.AutoCloseableprotected boolean isClosed()
protected abstract BsonBinary doReadBinaryData()
protected abstract byte doPeekBinarySubType()
protected abstract boolean doReadBoolean()
protected abstract long doReadDateTime()
protected abstract double doReadDouble()
protected abstract void doReadEndArray()
protected abstract void doReadEndDocument()
protected abstract int doReadInt32()
protected abstract long doReadInt64()
protected abstract java.lang.String doReadJavaScript()
protected abstract java.lang.String doReadJavaScriptWithScope()
protected abstract void doReadMaxKey()
protected abstract void doReadMinKey()
protected abstract void doReadNull()
protected abstract ObjectId doReadObjectId()
protected abstract BsonRegularExpression doReadRegularExpression()
protected abstract BsonDbPointer doReadDBPointer()
protected abstract void doReadStartArray()
protected abstract void doReadStartDocument()
protected abstract java.lang.String doReadString()
protected abstract java.lang.String doReadSymbol()
protected abstract BsonTimestamp doReadTimestamp()
protected abstract void doReadUndefined()
protected abstract void doSkipName()
protected abstract void doSkipValue()
public BsonBinary readBinaryData()
BsonReaderreadBinaryData 在接口中 BsonReaderpublic byte peekBinarySubType()
BsonReaderpeekBinarySubType 在接口中 BsonReaderBsonReader.mark()public boolean readBoolean()
BsonReaderreadBoolean 在接口中 BsonReaderpublic abstract BsonType readBsonType()
BsonReaderreadBsonType 在接口中 BsonReaderpublic long readDateTime()
BsonReaderreadDateTime 在接口中 BsonReaderpublic double readDouble()
BsonReaderreadDouble 在接口中 BsonReaderpublic void readEndArray()
BsonReaderreadEndArray 在接口中 BsonReaderpublic void readEndDocument()
BsonReaderreadEndDocument 在接口中 BsonReaderpublic int readInt32()
BsonReaderreadInt32 在接口中 BsonReaderpublic long readInt64()
BsonReaderreadInt64 在接口中 BsonReaderpublic java.lang.String readJavaScript()
BsonReaderreadJavaScript 在接口中 BsonReaderpublic java.lang.String readJavaScriptWithScope()
BsonReaderreadJavaScriptWithScope 在接口中 BsonReaderpublic void readMaxKey()
BsonReaderreadMaxKey 在接口中 BsonReaderpublic void readMinKey()
BsonReaderreadMinKey 在接口中 BsonReaderpublic void readNull()
BsonReaderreadNull 在接口中 BsonReaderpublic ObjectId readObjectId()
BsonReaderreadObjectId 在接口中 BsonReaderObjectId valuepublic BsonRegularExpression readRegularExpression()
BsonReaderreadRegularExpression 在接口中 BsonReaderpublic BsonDbPointer readDBPointer()
BsonReaderreadDBPointer 在接口中 BsonReaderpublic void readStartArray()
BsonReaderreadStartArray 在接口中 BsonReaderpublic void readStartDocument()
BsonReaderreadStartDocument 在接口中 BsonReaderpublic java.lang.String readString()
BsonReaderreadString 在接口中 BsonReaderpublic java.lang.String readSymbol()
BsonReaderreadSymbol 在接口中 BsonReaderpublic BsonTimestamp readTimestamp()
BsonReaderreadTimestamp 在接口中 BsonReaderpublic void readUndefined()
BsonReaderreadUndefined 在接口中 BsonReaderpublic void skipName()
BsonReaderskipName 在接口中 BsonReaderpublic void skipValue()
BsonReaderskipValue 在接口中 BsonReaderpublic BsonBinary readBinaryData(java.lang.String name)
BsonReaderreadBinaryData 在接口中 BsonReadername - The name of the element.public boolean readBoolean(java.lang.String name)
BsonReaderreadBoolean 在接口中 BsonReadername - The name of the element.public long readDateTime(java.lang.String name)
BsonReaderreadDateTime 在接口中 BsonReadername - The name of the element.public double readDouble(java.lang.String name)
BsonReaderreadDouble 在接口中 BsonReadername - The name of the element.public int readInt32(java.lang.String name)
BsonReaderreadInt32 在接口中 BsonReadername - The name of the element.public long readInt64(java.lang.String name)
BsonReaderreadInt64 在接口中 BsonReadername - The name of the element.public java.lang.String readJavaScript(java.lang.String name)
BsonReaderreadJavaScript 在接口中 BsonReadername - The name of the element.public java.lang.String readJavaScriptWithScope(java.lang.String name)
BsonReaderreadJavaScriptWithScope 在接口中 BsonReadername - The name of the element.public void readMaxKey(java.lang.String name)
BsonReaderreadMaxKey 在接口中 BsonReadername - The name of the element.public void readMinKey(java.lang.String name)
BsonReaderreadMinKey 在接口中 BsonReadername - The name of the element.public java.lang.String readName()
BsonReaderreadName 在接口中 BsonReaderpublic void readName(java.lang.String name)
BsonReaderreadName 在接口中 BsonReadername - The name of the element.public void readNull(java.lang.String name)
BsonReaderreadNull 在接口中 BsonReadername - The name of the element.public ObjectId readObjectId(java.lang.String name)
BsonReaderreadObjectId 在接口中 BsonReadername - The name of the element.public BsonRegularExpression readRegularExpression(java.lang.String name)
BsonReaderreadRegularExpression 在接口中 BsonReadername - The name of the element.public BsonDbPointer readDBPointer(java.lang.String name)
BsonReaderreadDBPointer 在接口中 BsonReadername - The name of the element.public java.lang.String readString(java.lang.String name)
BsonReaderreadString 在接口中 BsonReadername - The name of the element.public java.lang.String readSymbol(java.lang.String name)
BsonReaderreadSymbol 在接口中 BsonReadername - The name of the element.public BsonTimestamp readTimestamp(java.lang.String name)
BsonReaderreadTimestamp 在接口中 BsonReadername - The name of the element.public void readUndefined(java.lang.String name)
BsonReaderreadUndefined 在接口中 BsonReadername - The name of the element.protected void throwInvalidContextType(java.lang.String methodName,
BsonContextType actualContextType,
BsonContextType... validContextTypes)
methodName - The name of the method.actualContextType - The actual ContextType.validContextTypes - The valid ContextTypes.BsonInvalidOperationException - when the method called is not valid for the current ContextType.protected void throwInvalidState(java.lang.String methodName,
AbstractBsonReader.State... validStates)
methodName - The name of the method.validStates - The valid states.BsonInvalidOperationException - when the method called is not valid for the current state.protected void verifyBSONType(java.lang.String methodName,
BsonType requiredBsonType)
methodName - The name of the method calling this one.requiredBsonType - The required BSON type.protected void verifyName(java.lang.String expectedName)
expectedName - The expected name.BsonSerializationException - when the name read is not the expected nameprotected void checkPreconditions(java.lang.String methodName,
BsonType type)
methodName - the name of the current method, which will indicate the field being readtype - the type of this fieldprotected AbstractBsonReader.Context getContext()
protected void setContext(AbstractBsonReader.Context context)
context - the current context.protected AbstractBsonReader.State getNextState()
State to transition to, based on the AbstractBsonReader.Context of this reader.