org.apache.sqoop.lib

## Class BigDecimalSerializer

- java.lang.Object
- - org.apache.sqoop.lib.BigDecimalSerializer

-     public final class BigDecimalSerializer
      extends java.lang.Object

  Serialize BigDecimal classes to/from DataInput and DataOutput objects. BigDecimal is comprised of a BigInteger with an integer 'scale' field. The BigDecimal/BigInteger can also return itself as a 'long' value. We serialize in one of two formats: First, check whether the BigInt can fit in a long: boolean b = BigIntegerPart > LONG_MAX || BigIntegerPart < LONG_MIN [int: scale][boolean: b == false][long: BigInt-part] [int: scale][boolean: b == true][string: BigInt-part.toString()] TODO(aaron): Get this to work with Hadoop's Serializations framework.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.math.BigInteger` | `LONG_MAX_AS_BIGINT`
    `static java.math.BigInteger` | `LONG_MIN_AS_BIGINT`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.math.BigDecimal` | `readFields(java.io.DataInput in)`
    `static void` | `write(java.math.BigDecimal d, java.io.DataOutput out)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LONG_MAX_AS_BIGINT

          public static final java.math.BigInteger LONG_MAX_AS_BIGINT

    - #### LONG_MIN_AS_BIGINT

          public static final java.math.BigInteger LONG_MIN_AS_BIGINT

  - ### Method Detail

    - #### write

          public static void write(java.math.BigDecimal d,
                   java.io.DataOutput out)
                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readFields

          public static java.math.BigDecimal readFields(java.io.DataInput in)
                                                 throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright © 2015 The Apache Software Foundation