Package org.bson
Class BsonBinaryReader
java.lang.Object
org.bson.AbstractBsonReader
org.bson.BsonBinaryReader
- All Implemented Interfaces:
Closeable,AutoCloseable,BsonReader
A BsonReader implementation that reads from a binary stream of data. This is the most commonly used implementation.
- Since:
- 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAn implementation ofAbstractBsonReader.Context.protected classAn implementation ofAbstractBsonReader.Mark.Nested classes/interfaces inherited from class org.bson.AbstractBsonReader
AbstractBsonReader.State -
Constructor Summary
ConstructorsConstructorDescriptionBsonBinaryReader(ByteBuffer byteBuffer) Construct an instance.BsonBinaryReader(BsonInput bsonInput) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the reader.protected intHandles the logic to peek at the binary size.protected byteHandles the logic to peek at the binary subtype.protected BsonBinaryHandles the logic to read binary dataprotected booleanHandles the logic to read booleansprotected longHandles the logic to read date timeprotected BsonDbPointerHandles the logic to read a DBPointerHandles the logic to read Decimal128protected doubleHandles the logic to read doublesprotected voidHandles the logic when reading the end of an arrayprotected voidHandles the logic when reading the end of a documentprotected intHandles the logic to read 32 bit intsprotected longHandles the logic to read 64 bit intsprotected StringHandles the logic to read JavaScript functionsprotected StringHandles the logic to read scoped JavaScript functionsprotected voidHandles the logic to read a Max keyprotected voidHandles the logic to read a Min keyprotected voidHandles the logic to read a null valueprotected ObjectIdHandles the logic to read an ObjectIdprotected BsonRegularExpressionHandles the logic to read a regular expressionvoidHandles the logic to read the start of an arrayprotected voidHandles the logic to read the start of a documentprotected StringHandles the logic to read a Stringprotected StringHandles the logic to read a Symbolprotected BsonTimestampHandles the logic to read a timestampprotected voidHandles the logic to read an Undefined valueprotected voidHandles any logic required to skip the name (reader must be positioned on a name).protected voidHandles any logic required to skip the value (reader must be positioned on a value).Gets the BSON input backing this instance.protected BsonBinaryReader.ContextGet the context, which will indicate which state the reader is in, for example which part of a document it's currently reading.getMark()Gets a mark representing the current state of the reader.Reads a BSONType from the reader.Methods inherited from class org.bson.AbstractBsonReader
checkPreconditions, 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 Details
-
BsonBinaryReader
Construct an instance.- Parameters:
byteBuffer- the input for this reader
-
BsonBinaryReader
Construct an instance.- Parameters:
bsonInput- the input for this reader
-
-
Method Details
-
close
public void close()Description copied from class:AbstractBsonReaderCloses the reader.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBsonReader- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractBsonReader
-
getBsonInput
Gets the BSON input backing this instance.- Returns:
- the BSON input
-
readBsonType
Description copied from interface:BsonReaderReads a BSONType from the reader.- Specified by:
readBsonTypein interfaceBsonReader- Specified by:
readBsonTypein classAbstractBsonReader- Returns:
- A BSONType.
-
doReadBinaryData
Description copied from class:AbstractBsonReaderHandles the logic to read binary data- Specified by:
doReadBinaryDatain classAbstractBsonReader- Returns:
- the BsonBinary value
-
doPeekBinarySubType
protected byte doPeekBinarySubType()Description copied from class:AbstractBsonReaderHandles the logic to peek at the binary subtype.- Specified by:
doPeekBinarySubTypein classAbstractBsonReader- Returns:
- the binary subtype
-
doPeekBinarySize
protected int doPeekBinarySize()Description copied from class:AbstractBsonReaderHandles the logic to peek at the binary size.- Specified by:
doPeekBinarySizein classAbstractBsonReader- Returns:
- the binary size
-
doReadBoolean
protected boolean doReadBoolean()Description copied from class:AbstractBsonReaderHandles the logic to read booleans- Specified by:
doReadBooleanin classAbstractBsonReader- Returns:
- the boolean value
-
doReadDateTime
protected long doReadDateTime()Description copied from class:AbstractBsonReaderHandles the logic to read date time- Specified by:
doReadDateTimein classAbstractBsonReader- Returns:
- the long value
-
doReadDouble
protected double doReadDouble()Description copied from class:AbstractBsonReaderHandles the logic to read doubles- Specified by:
doReadDoublein classAbstractBsonReader- Returns:
- the double value
-
doReadInt32
protected int doReadInt32()Description copied from class:AbstractBsonReaderHandles the logic to read 32 bit ints- Specified by:
doReadInt32in classAbstractBsonReader- Returns:
- the int value
-
doReadInt64
protected long doReadInt64()Description copied from class:AbstractBsonReaderHandles the logic to read 64 bit ints- Specified by:
doReadInt64in classAbstractBsonReader- Returns:
- the long value
-
doReadDecimal128
Description copied from class:AbstractBsonReaderHandles the logic to read Decimal128- Specified by:
doReadDecimal128in classAbstractBsonReader- Returns:
- the Decimal128 value
-
doReadJavaScript
Description copied from class:AbstractBsonReaderHandles the logic to read JavaScript functions- Specified by:
doReadJavaScriptin classAbstractBsonReader- Returns:
- the String value
-
doReadJavaScriptWithScope
Description copied from class:AbstractBsonReaderHandles the logic to read scoped JavaScript functions- Specified by:
doReadJavaScriptWithScopein classAbstractBsonReader- Returns:
- the String value
-
doReadMaxKey
protected void doReadMaxKey()Description copied from class:AbstractBsonReaderHandles the logic to read a Max key- Specified by:
doReadMaxKeyin classAbstractBsonReader
-
doReadMinKey
protected void doReadMinKey()Description copied from class:AbstractBsonReaderHandles the logic to read a Min key- Specified by:
doReadMinKeyin classAbstractBsonReader
-
doReadNull
protected void doReadNull()Description copied from class:AbstractBsonReaderHandles the logic to read a null value- Specified by:
doReadNullin classAbstractBsonReader
-
doReadObjectId
Description copied from class:AbstractBsonReaderHandles the logic to read an ObjectId- Specified by:
doReadObjectIdin classAbstractBsonReader- Returns:
- the ObjectId value
-
doReadRegularExpression
Description copied from class:AbstractBsonReaderHandles the logic to read a regular expression- Specified by:
doReadRegularExpressionin classAbstractBsonReader- Returns:
- the BsonRegularExpression value
-
doReadDBPointer
Description copied from class:AbstractBsonReaderHandles the logic to read a DBPointer- Specified by:
doReadDBPointerin classAbstractBsonReader- Returns:
- the BsonDbPointer value
-
doReadString
Description copied from class:AbstractBsonReaderHandles the logic to read a String- Specified by:
doReadStringin classAbstractBsonReader- Returns:
- the String value
-
doReadSymbol
Description copied from class:AbstractBsonReaderHandles the logic to read a Symbol- Specified by:
doReadSymbolin classAbstractBsonReader- Returns:
- the String value
-
doReadTimestamp
Description copied from class:AbstractBsonReaderHandles the logic to read a timestamp- Specified by:
doReadTimestampin classAbstractBsonReader- Returns:
- the BsonTimestamp value
-
doReadUndefined
protected void doReadUndefined()Description copied from class:AbstractBsonReaderHandles the logic to read an Undefined value- Specified by:
doReadUndefinedin classAbstractBsonReader
-
doReadStartArray
public void doReadStartArray()Description copied from class:AbstractBsonReaderHandles the logic to read the start of an array- Specified by:
doReadStartArrayin classAbstractBsonReader
-
doReadStartDocument
protected void doReadStartDocument()Description copied from class:AbstractBsonReaderHandles the logic to read the start of a document- Specified by:
doReadStartDocumentin classAbstractBsonReader
-
doReadEndArray
protected void doReadEndArray()Description copied from class:AbstractBsonReaderHandles the logic when reading the end of an array- Specified by:
doReadEndArrayin classAbstractBsonReader
-
doReadEndDocument
protected void doReadEndDocument()Description copied from class:AbstractBsonReaderHandles the logic when reading the end of a document- Specified by:
doReadEndDocumentin classAbstractBsonReader
-
doSkipName
protected void doSkipName()Description copied from class:AbstractBsonReaderHandles any logic required to skip the name (reader must be positioned on a name).- Specified by:
doSkipNamein classAbstractBsonReader
-
doSkipValue
protected void doSkipValue()Description copied from class:AbstractBsonReaderHandles any logic required to skip the value (reader must be positioned on a value).- Specified by:
doSkipValuein classAbstractBsonReader
-
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 classAbstractBsonReader- Returns:
- the context
-
getMark
Description copied from interface:BsonReaderGets a mark representing the current state of the reader.- Returns:
- the mark
-