Package io.micronaut.serde.bson
Class BsonWriterEncoder
java.lang.Object
io.micronaut.serde.LimitingStream
io.micronaut.serde.bson.BsonWriterEncoder
- All Implemented Interfaces:
Encoder,AutoCloseable
Bson implementation of
Encoder.- Author:
- Denis Stepanov
-
Nested Class Summary
Nested classes/interfaces inherited from class io.micronaut.serde.LimitingStream
LimitingStream.RemainingLimits -
Field Summary
Fields inherited from class io.micronaut.serde.LimitingStream
DEFAULT_LIMITS, DEFAULT_MAXIMUM_DEPTH -
Constructor Summary
ConstructorsConstructorDescriptionBsonWriterEncoder(org.bson.BsonWriter bsonWriter, LimitingStream.RemainingLimits remainingLimits) -
Method Summary
Modifier and TypeMethodDescription@NonNull StringReturn an analysis of the current path.encodeArray(io.micronaut.core.type.Argument<?> type) Encodes an array.voidencodeBigDecimal(BigDecimal value) Encode a BigDecimal.voidencodeBigInteger(BigInteger value) Encode a BigInteger.voidencodeBinary(byte @NonNull [] data) Encode the given binary data.voidencodeBoolean(boolean value) Encode a boolean.voidencodeByte(byte value) Encode a byte.voidencodeChar(char value) Encode a char.voidencodeDecimal128(org.bson.types.Decimal128 value) voidencodeDouble(double value) Encode a double.voidencodeFloat(float value) Encode a float.voidencodeInt(int value) Encode an int.voidEncode a key.voidencodeLong(long value) Encode a long.voidEncodenull.encodeObject(io.micronaut.core.type.Argument<?> type) Encodes an object.voidencodeObjectId(org.bson.types.ObjectId value) voidencodeShort(short value) Encode a short.voidencodeString(String value) Encode a string.voidFinalize a previously created structure, like an array or object.org.bson.BsonWriterMethods inherited from class io.micronaut.serde.LimitingStream
childLimits, decreaseDepth, increaseDepth, limitsFromConfiguration, ourLimits
-
Constructor Details
-
BsonWriterEncoder
public BsonWriterEncoder(org.bson.BsonWriter bsonWriter, LimitingStream.RemainingLimits remainingLimits)
-
-
Method Details
-
encodeArray
Description copied from interface:EncoderEncodes an array.- Specified by:
encodeArrayin interfaceEncoder- Parameters:
type- The array type, nevernull- Returns:
- The encoder, never
null - Throws:
SerdeException
-
encodeObject
Description copied from interface:EncoderEncodes an object.- Specified by:
encodeObjectin interfaceEncoder- Parameters:
type- The object type, nevernull- Returns:
- The encoder, never
null - Throws:
SerdeException
-
finishStructure
public void finishStructure()Description copied from interface:EncoderFinalize a previously created structure, like an array or object.- Specified by:
finishStructurein interfaceEncoder
-
encodeKey
Description copied from interface:EncoderEncode a key. -
encodeString
Description copied from interface:EncoderEncode a string.- Specified by:
encodeStringin interfaceEncoder- Parameters:
value- The string, nevernull
-
encodeBoolean
public void encodeBoolean(boolean value) Description copied from interface:EncoderEncode a boolean.- Specified by:
encodeBooleanin interfaceEncoder- Parameters:
value- The boolean
-
encodeByte
public void encodeByte(byte value) Description copied from interface:EncoderEncode a byte.- Specified by:
encodeBytein interfaceEncoder- Parameters:
value- The byte
-
encodeShort
public void encodeShort(short value) Description copied from interface:EncoderEncode a short.- Specified by:
encodeShortin interfaceEncoder- Parameters:
value- The short
-
encodeChar
public void encodeChar(char value) Description copied from interface:EncoderEncode a char.- Specified by:
encodeCharin interfaceEncoder- Parameters:
value- The char
-
encodeInt
public void encodeInt(int value) Description copied from interface:EncoderEncode an int. -
encodeLong
public void encodeLong(long value) Description copied from interface:EncoderEncode a long.- Specified by:
encodeLongin interfaceEncoder- Parameters:
value- The long
-
encodeFloat
public void encodeFloat(float value) Description copied from interface:EncoderEncode a float.- Specified by:
encodeFloatin interfaceEncoder- Parameters:
value- The float
-
encodeDouble
public void encodeDouble(double value) Description copied from interface:EncoderEncode a double.- Specified by:
encodeDoublein interfaceEncoder- Parameters:
value- The double
-
encodeBigInteger
Description copied from interface:EncoderEncode a BigInteger.- Specified by:
encodeBigIntegerin interfaceEncoder- Parameters:
value- The BigInteger, nevernull
-
encodeBigDecimal
Description copied from interface:EncoderEncode a BigDecimal.- Specified by:
encodeBigDecimalin interfaceEncoder- Parameters:
value- The BigDecimal, nevernull
-
encodeBinary
Description copied from interface:EncoderEncode the given binary data. The shape of the data in the output is unspecified, the only requirement is that the equivalentDecoder.decodeBinary()must be able to parse to the same data.- Specified by:
encodeBinaryin interfaceEncoder- Parameters:
data- The input data- Throws:
IOException
-
encodeNull
public void encodeNull()Description copied from interface:EncoderEncodenull.- Specified by:
encodeNullin interfaceEncoder
-
currentPath
Description copied from interface:EncoderReturn an analysis of the current path.- Specified by:
currentPathin interfaceEncoder- Returns:
- The current path if known
-
encodeDecimal128
public void encodeDecimal128(org.bson.types.Decimal128 value) -
encodeObjectId
public void encodeObjectId(org.bson.types.ObjectId value) -
getBsonWriter
public org.bson.BsonWriter getBsonWriter()
-