Package org.bson
Interface BsonReader
- 
- All Superinterfaces:
- AutoCloseable,- Closeable
 - All Known Implementing Classes:
- AbstractBsonReader,- BsonBinaryReader,- BsonDocumentReader,- JsonReader
 
 public interface BsonReader extends Closeable An interface for reading a logical BSON document using a pull-oriented API.- Since:
- 3.0
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidclose()BsonTypegetCurrentBsonType()StringgetCurrentName()Gets the most recently read name.BsonReaderMarkgetMark()Gets a mark representing the current state of the reader.voidmark()Deprecated.UsegetMark()insteadintpeekBinarySize()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.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.voidreset()Deprecated.PrefergetMark()voidskipName()Skips the name (reader must be positioned on a name).voidskipValue()Skips the value (reader must be positioned on a value).
 
- 
- 
- 
Method Detail- 
getCurrentBsonTypeBsonType getCurrentBsonType() - Returns:
- The current BsonType.
 
 - 
getCurrentNameString getCurrentName() Gets the most recently read name.- Returns:
- the most recently read name
 
 - 
readBinaryDataBsonBinary readBinaryData() Reads BSON Binary data from the reader.- Returns:
- A Binary.
 
 - 
peekBinarySubTypebyte peekBinarySubType() Peeks the subtype of the binary data that the reader is positioned at. This operation is not permitted if the mark is already set.- Returns:
- the subtype
- See Also:
- mark()
 
 - 
peekBinarySizeint peekBinarySize() Peeks the size of the binary data that the reader is positioned at. This operation is not permitted if the mark is already set.- Returns:
- the size of the binary data
- Since:
- 3.4
- See Also:
- mark()
 
 - 
readBinaryDataBsonBinary readBinaryData(String name) Reads a BSON Binary data element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A Binary.
 
 - 
readBooleanboolean readBoolean() Reads a BSON Boolean from the reader.- Returns:
- A Boolean.
 
 - 
readBooleanboolean readBoolean(String name) Reads a BSON Boolean element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A Boolean.
 
 - 
readBsonTypeBsonType readBsonType() Reads a BSONType from the reader.- Returns:
- A BSONType.
 
 - 
readDateTimelong readDateTime() Reads a BSON DateTime from the reader.- Returns:
- The number of milliseconds since the Unix epoch.
 
 - 
readDateTimelong readDateTime(String name) Reads a BSON DateTime element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- The number of milliseconds since the Unix epoch.
 
 - 
readDoubledouble readDouble() Reads a BSON Double from the reader.- Returns:
- A Double.
 
 - 
readDoubledouble readDouble(String name) Reads a BSON Double element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A Double.
 
 - 
readEndArrayvoid readEndArray() Reads the end of a BSON array from the reader.
 - 
readEndDocumentvoid readEndDocument() Reads the end of a BSON document from the reader.
 - 
readInt32int readInt32() Reads a BSON Int32 from the reader.- Returns:
- An Int32.
 
 - 
readInt32int readInt32(String name) Reads a BSON Int32 element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- An Int32.
 
 - 
readInt64long readInt64() Reads a BSON Int64 from the reader.- Returns:
- An Int64.
 
 - 
readInt64long readInt64(String name) Reads a BSON Int64 element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- An Int64.
 
 - 
readDecimal128Decimal128 readDecimal128() Reads a BSON Decimal128 from the reader.- Returns:
- A Decimal128
- Since:
- 3.4
 
 - 
readDecimal128Decimal128 readDecimal128(String name) Reads a BSON Decimal128 element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A Decimal128
- Since:
- 3.4
 
 - 
readJavaScriptString readJavaScript() Reads a BSON JavaScript from the reader.- Returns:
- A string.
 
 - 
readJavaScriptString readJavaScript(String name) Reads a BSON JavaScript element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A string.
 
 - 
readJavaScriptWithScopeString readJavaScriptWithScope() Reads a BSON JavaScript with scope from the reader (call readStartDocument next to read the scope).- Returns:
- A string.
 
 - 
readJavaScriptWithScopeString readJavaScriptWithScope(String name) Reads a BSON JavaScript with scope element from the reader (call readStartDocument next to read the scope).- Parameters:
- name- The name of the element.
- Returns:
- A string.
 
 - 
readMaxKeyvoid readMaxKey() Reads a BSON MaxKey from the reader.
 - 
readMaxKeyvoid readMaxKey(String name) Reads a BSON MaxKey element from the reader.- Parameters:
- name- The name of the element.
 
 - 
readMinKeyvoid readMinKey() Reads a BSON MinKey from the reader.
 - 
readMinKeyvoid readMinKey(String name) Reads a BSON MinKey element from the reader.- Parameters:
- name- The name of the element.
 
 - 
readNameString readName() Reads the name of an element from the reader.- Returns:
- The name of the element.
 
 - 
readNamevoid readName(String name) Reads the name of an element from the reader.- Parameters:
- name- The name of the element.
 
 - 
readNullvoid readNull() Reads a BSON null from the reader.
 - 
readNullvoid readNull(String name) Reads a BSON null element from the reader.- Parameters:
- name- The name of the element.
 
 - 
readObjectIdObjectId readObjectId() Reads a BSON ObjectId from the reader.- Returns:
- the ObjectIdvalue
 
 - 
readObjectIdObjectId readObjectId(String name) Reads a BSON ObjectId element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- ObjectId.
 
 - 
readRegularExpressionBsonRegularExpression readRegularExpression() Reads a BSON regular expression from the reader.- Returns:
- A regular expression.
 
 - 
readRegularExpressionBsonRegularExpression readRegularExpression(String name) Reads a BSON regular expression element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A regular expression.
 
 - 
readDBPointerBsonDbPointer readDBPointer() Reads a BSON DBPointer from the reader.- Returns:
- A DBPointer.
 
 - 
readDBPointerBsonDbPointer readDBPointer(String name) Reads a BSON DBPointer element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A DBPointer.
 
 - 
readStartArrayvoid readStartArray() Reads the start of a BSON array.
 - 
readStartDocumentvoid readStartDocument() Reads the start of a BSON document.
 - 
readStringString readString() Reads a BSON String from the reader.- Returns:
- A String.
 
 - 
readStringString readString(String name) Reads a BSON string element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A String.
 
 - 
readSymbolString readSymbol() Reads a BSON symbol from the reader.- Returns:
- A string.
 
 - 
readSymbolString readSymbol(String name) Reads a BSON symbol element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- A string.
 
 - 
readTimestampBsonTimestamp readTimestamp() Reads a BSON timestamp from the reader.- Returns:
- The combined timestamp/increment.
 
 - 
readTimestampBsonTimestamp readTimestamp(String name) Reads a BSON timestamp element from the reader.- Parameters:
- name- The name of the element.
- Returns:
- The combined timestamp/increment.
 
 - 
readUndefinedvoid readUndefined() Reads a BSON undefined from the reader.
 - 
readUndefinedvoid readUndefined(String name) Reads a BSON undefined element from the reader.- Parameters:
- name- The name of the element.
 
 - 
skipNamevoid skipName() Skips the name (reader must be positioned on a name).
 - 
skipValuevoid skipValue() Skips the value (reader must be positioned on a value).
 - 
mark@Deprecated void mark() Deprecated.UsegetMark()insteadCreates a bookmark in the BsonReader's input The previous mark must be cleared before creating a new one
 - 
getMarkBsonReaderMark getMark() Gets a mark representing the current state of the reader.- Returns:
- the mark
- Since:
- 3.5
 
 - 
reset@Deprecated void reset() Deprecated.PrefergetMark()Go back to the state at the last mark and removes the mark- Throws:
- BSONException- if no mark has been set
 
 - 
closevoid close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
- 
 
-