com.cloudera.sqoop.lib
Class BigDecimalSerializer

java.lang.Object
  extended by com.cloudera.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.


Method Summary
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
 

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 © 2013 The Apache Software Foundation