question: private void writeDecimalValue ( final BigDecimal value ) { final boolean isNegZero = isNegativeZero ( value ) ; final int signum = value . signum ( ) ; final int exponent = - value . scale ( ) ; writeVarInt ( exponent ) ; final BigInteger mantissaBigInt = value . unscaledValue ( ) ; if ( mantissaBigInt . compareTo ( BIG_INT_LONG_MIN_VALUE ) >= 0 && mantissaBigInt . compareTo ( BIG_INT_LONG_MAX_VALUE ) <= 0 ) { final long mantissa = mantissaBigInt . longValue ( ) ; if ( signum == 0 && ! isNegZero ) { } else if ( isNegZero ) { updateLength ( 1 ) ; buffer . writeByte ( DECIMAL_NEGATIVE_ZERO_MANTISSA ) ; } else if ( mantissa == Long . MIN_VALUE ) { updateLength ( 9 ) ; buffer . writeUInt8 ( 0x80 ) ; buffer . writeUInt64 ( mantissa ) ; } else if ( mantissa >= 0xFFFFFFFFFFFFFF81L && mantissa <= 0x000000000000007FL ) { updateLength ( 1 ) ; buffer . writeInt8 ( mantissa ) ; } else if ( mantissa >= 0xFFFFFFFFFFFF8001L && mantissa <= 0x0000000000007FFFL ) { updateLength ( 2 ) ; buffer . writeInt16 ( mantissa ) ; } else if ( mantissa >= 0xFFFFFFFFFF800001L && mantissa <= 0x00000000007FFFFFL ) { updateLength ( 3 ) ; buffer . writeInt24 ( mantissa ) ; } else if ( mantissa >= 0xFFFFFFFF80000001L && mantissa <= 0x000000007FFFFFFFL ) { updateLength ( 4 ) ; buffer . writeInt32 ( mantissa ) ; } else if ( mantissa >= 0xFFFFFF8000000001L && mantissa <= 0x0000007FFFFFFFFFL ) { updateLength ( 5 ) ; buffer . writeInt40 ( mantissa ) ; } else if ( mantissa >= 0xFFFF800000000001L && mantissa <= 0x00007FFFFFFFFFFFL ) { updateLength ( 6 ) ; buffer . writeInt48 ( mantissa ) ; } else if ( mantissa >= 0xFF80000000000001L && mantissa <= 0x007FFFFFFFFFFFFFL ) { updateLength ( 7 ) ; buffer . writeInt56 ( mantissa ) ; } else { updateLength ( 8 ) ; buffer . writeInt64 ( mantissa ) ; } } else { final BigInteger magnitude = signum > 0 ? mantissaBigInt : mantissaBigInt . negate ( ) ; final byte [ ] bits = magnitude . toByteArray ( ) ; if ( signum < 0 ) { if ( ( bits [ 0 ] & 0x80 ) == 0 ) { bits [ 0 ] |= 0x80 ; } else { updateLength ( 1 ) ; buffer . writeUInt8 ( 0x80 ) ; } } updateLength ( bits . length ) ; buffer . writeBytes ( bits ) ; } }
target:  Encodes a decimal, updating the current container length context (which is probably a Decimal/Timestamp). 