Class BsonWriterEncoder

java.lang.Object
io.micronaut.serde.LimitingStream
io.micronaut.serde.bson.BsonWriterEncoder
All Implemented Interfaces:
Encoder, AutoCloseable

@Internal public final class BsonWriterEncoder extends LimitingStream implements Encoder
Bson implementation of Encoder.
Author:
Denis Stepanov
  • Constructor Details

  • Method Details

    • encodeArray

      public Encoder encodeArray(io.micronaut.core.type.Argument<?> type) throws SerdeException
      Description copied from interface: Encoder
      Encodes an array.
      Specified by:
      encodeArray in interface Encoder
      Parameters:
      type - The array type, never null
      Returns:
      The encoder, never null
      Throws:
      SerdeException
    • encodeObject

      public Encoder encodeObject(io.micronaut.core.type.Argument<?> type) throws SerdeException
      Description copied from interface: Encoder
      Encodes an object.
      Specified by:
      encodeObject in interface Encoder
      Parameters:
      type - The object type, never null
      Returns:
      The encoder, never null
      Throws:
      SerdeException
    • finishStructure

      public void finishStructure()
      Description copied from interface: Encoder
      Finalize a previously created structure, like an array or object.
      Specified by:
      finishStructure in interface Encoder
    • encodeKey

      public void encodeKey(String key)
      Description copied from interface: Encoder
      Encode a key.
      Specified by:
      encodeKey in interface Encoder
      Parameters:
      key - The key, never null
    • encodeString

      public void encodeString(String value)
      Description copied from interface: Encoder
      Encode a string.
      Specified by:
      encodeString in interface Encoder
      Parameters:
      value - The string, never null
    • encodeBoolean

      public void encodeBoolean(boolean value)
      Description copied from interface: Encoder
      Encode a boolean.
      Specified by:
      encodeBoolean in interface Encoder
      Parameters:
      value - The boolean
    • encodeByte

      public void encodeByte(byte value)
      Description copied from interface: Encoder
      Encode a byte.
      Specified by:
      encodeByte in interface Encoder
      Parameters:
      value - The byte
    • encodeShort

      public void encodeShort(short value)
      Description copied from interface: Encoder
      Encode a short.
      Specified by:
      encodeShort in interface Encoder
      Parameters:
      value - The short
    • encodeChar

      public void encodeChar(char value)
      Description copied from interface: Encoder
      Encode a char.
      Specified by:
      encodeChar in interface Encoder
      Parameters:
      value - The char
    • encodeInt

      public void encodeInt(int value)
      Description copied from interface: Encoder
      Encode an int.
      Specified by:
      encodeInt in interface Encoder
      Parameters:
      value - The int
    • encodeLong

      public void encodeLong(long value)
      Description copied from interface: Encoder
      Encode a long.
      Specified by:
      encodeLong in interface Encoder
      Parameters:
      value - The long
    • encodeFloat

      public void encodeFloat(float value)
      Description copied from interface: Encoder
      Encode a float.
      Specified by:
      encodeFloat in interface Encoder
      Parameters:
      value - The float
    • encodeDouble

      public void encodeDouble(double value)
      Description copied from interface: Encoder
      Encode a double.
      Specified by:
      encodeDouble in interface Encoder
      Parameters:
      value - The double
    • encodeBigInteger

      public void encodeBigInteger(BigInteger value)
      Description copied from interface: Encoder
      Encode a BigInteger.
      Specified by:
      encodeBigInteger in interface Encoder
      Parameters:
      value - The BigInteger, never null
    • encodeBigDecimal

      public void encodeBigDecimal(BigDecimal value)
      Description copied from interface: Encoder
      Encode a BigDecimal.
      Specified by:
      encodeBigDecimal in interface Encoder
      Parameters:
      value - The BigDecimal, never null
    • encodeBinary

      public void encodeBinary(byte @NonNull [] data) throws IOException
      Description copied from interface: Encoder
      Encode the given binary data. The shape of the data in the output is unspecified, the only requirement is that the equivalent Decoder.decodeBinary() must be able to parse to the same data.
      Specified by:
      encodeBinary in interface Encoder
      Parameters:
      data - The input data
      Throws:
      IOException
    • encodeNull

      public void encodeNull()
      Description copied from interface: Encoder
      Encode null.
      Specified by:
      encodeNull in interface Encoder
    • currentPath

      @NonNull public @NonNull String currentPath()
      Description copied from interface: Encoder
      Return an analysis of the current path.
      Specified by:
      currentPath in interface Encoder
      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()