@Internal public final class BsonReaderDecoder extends AbstractStreamDecoder
Decoder.AbstractStreamDecoder.TokenType, AbstractStreamDecoder.ValueDecoder<R>| Constructor and Description |
|---|
BsonReaderDecoder(org.bson.BsonReader bsonReader) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
backFromChild(AbstractStreamDecoder child)
Called when the old child has finished processing and returns control of the stream to the parent.
|
protected java.lang.String |
coerceScalarToString()
Decode any non-null scalar value (number, string or boolean) to its string representation.
|
protected AbstractStreamDecoder |
createChildDecoder()
Create a new child decoder using
AbstractStreamDecoder(AbstractStreamDecoder). |
java.io.IOException |
createDeserializationException(java.lang.String message,
java.lang.Object invalidValue)
Creates an exception for the given message.
|
protected AbstractStreamDecoder.TokenType |
currentToken() |
Decoder |
decodeBuffer()
Buffer the whole subtree of this value and return it as a new
Decoder. |
<T> T |
decodeCustom(org.bson.codecs.Decoder<T> decoder,
org.bson.codecs.DecoderContext context) |
org.bson.types.Decimal128 |
decodeDecimal128()
Decodes
Decimal128. |
org.bson.types.ObjectId |
decodeObjectId()
Decodes
ObjectId. |
protected java.lang.Number |
getBestNumber()
Decode the current
AbstractStreamDecoder.TokenType.NUMBER value as a Number value. |
protected java.math.BigDecimal |
getBigDecimal()
Decode the current
AbstractStreamDecoder.TokenType.NUMBER value as a BigDecimal value. |
protected java.math.BigInteger |
getBigInteger()
Decode the current
AbstractStreamDecoder.TokenType.NUMBER value as a BigInteger value. |
protected boolean |
getBoolean()
Decode the current
AbstractStreamDecoder.TokenType.BOOLEAN value. |
protected java.lang.String |
getCurrentKey()
Get the current object field name.
|
protected double |
getDouble()
Decode the current
AbstractStreamDecoder.TokenType.NUMBER value as a double value. |
protected long |
getLong()
Decode the current
AbstractStreamDecoder.TokenType.NUMBER value as a long value. |
protected void |
nextToken()
Move to the next token.
|
protected void |
skipChildren()
If we are at a
AbstractStreamDecoder.TokenType.START_OBJECT or AbstractStreamDecoder.TokenType.START_ARRAY, skip to the matching
AbstractStreamDecoder.TokenType.END_OBJECT or AbstractStreamDecoder.TokenType.END_ARRAY. |
decodeArbitrary, decodeArray, decodeBigDecimal, decodeBigInteger, decodeBoolean, decodeByte, decodeChar, decodeCustom, decodeCustom, decodeDouble, decodeFloat, decodeInt, decodeKey, decodeLong, decodeNull, decodeNumber, decodeObject, decodeShort, decodeString, finishStructure, getBestNumberNode, getInteger, hasNextArrayValue, skipValue, unexpectedTokenclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, decodeArray, decodeObjectprotected void backFromChild(AbstractStreamDecoder child) throws java.io.IOException
AbstractStreamDecoderAbstractStreamDecoder.TokenType.END_ARRAY or AbstractStreamDecoder.TokenType.END_OBJECT. However we AbstractStreamDecoder.currentToken()
may hold an outdated value until AbstractStreamDecoder.nextToken() is called, which this method does.backFromChild in class AbstractStreamDecoderchild - The now-invalid child decoder.java.io.IOException - if an unrecoverable error occursprotected void nextToken()
AbstractStreamDecodernextToken in class AbstractStreamDecoderprotected java.lang.String getCurrentKey()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.KEY.getCurrentKey in class AbstractStreamDecoderprotected java.lang.String coerceScalarToString()
throws java.io.IOException
AbstractStreamDecodercoerceScalarToString in class AbstractStreamDecoderjava.io.IOException - if an unrecoverable error occursprotected AbstractStreamDecoder createChildDecoder()
AbstractStreamDecoderAbstractStreamDecoder(AbstractStreamDecoder).createChildDecoder in class AbstractStreamDecoderprotected boolean getBoolean()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.BOOLEAN value. Called for no other token type.getBoolean in class AbstractStreamDecoderprotected long getLong()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.NUMBER value as a long value. Called for no other token type.getLong in class AbstractStreamDecoderprotected double getDouble()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.NUMBER value as a double value. Called for no other token type.getDouble in class AbstractStreamDecoderprotected java.math.BigInteger getBigInteger()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.NUMBER value as a BigInteger value. Called for no other token type.getBigInteger in class AbstractStreamDecoderprotected java.math.BigDecimal getBigDecimal()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.NUMBER value as a BigDecimal value. Called for no other token type.getBigDecimal in class AbstractStreamDecoderprotected java.lang.Number getBestNumber()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.NUMBER value as a Number value. Called for no other token type.getBestNumber in class AbstractStreamDecoderprotected void skipChildren()
AbstractStreamDecoderAbstractStreamDecoder.TokenType.START_OBJECT or AbstractStreamDecoder.TokenType.START_ARRAY, skip to the matching
AbstractStreamDecoder.TokenType.END_OBJECT or AbstractStreamDecoder.TokenType.END_ARRAY. Else, do nothing.skipChildren in class AbstractStreamDecoderprotected AbstractStreamDecoder.TokenType currentToken()
currentToken in class AbstractStreamDecoderpublic java.io.IOException createDeserializationException(java.lang.String message,
java.lang.Object invalidValue)
Decodermessage - The message, never nullinvalidValue - The invalid value. Can be null.nullpublic org.bson.types.Decimal128 decodeDecimal128()
throws java.io.IOException
Decimal128.java.io.IOExceptionpublic org.bson.types.ObjectId decodeObjectId()
throws java.io.IOException
ObjectId.java.io.IOExceptionpublic <T> T decodeCustom(org.bson.codecs.Decoder<T> decoder,
org.bson.codecs.DecoderContext context)
throws java.io.IOException
java.io.IOExceptionpublic Decoder decodeBuffer() throws java.io.IOException
DecoderDecoder. The returned Decoder can
be used independently to this Decoder. This means actual parsing of the subtree can be delayed.
The returned Decoder should behave identically to this Decoder. This means that for example
decoder.decodeDouble() should be equivalent to decoder.decodeBuffer().decodeDouble().
decodeBuffer in interface DecoderdecodeBuffer in class AbstractStreamDecoderjava.io.IOException - If an unrecoverable error occurs