Class Decimal
java.lang.Object
org.apache.derby.client.am.Decimal
Converters from fixed point decimal bytes to
java.math.BigDecimal, double, or
long.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MessageUtilstatic final intPacked Decimal representationprivate static final int[][] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final intbigDecimalToPackedDecimalBytes(byte[] buffer, int offset, BigDecimal b, int declaredPrecision, int declaredScale) Write a Javajava.math.BigDecimalto packed decimal bytes.private static final int[]computeMagnitude(int[] input) Compute the int array of magnitude from input value segments.(package private) static BigDecimalgetBigDecimal(byte[] buffer, int offset, int precision, int scale) Build ajava.math.BigDecimalfrom a fixed point decimal byte representation.(package private) static doublegetDouble(byte[] buffer, int offset, int precision, int scale) Build a Javadoublefrom a fixed point decimal byte representation.(package private) static longgetLong(byte[] buffer, int offset, int precision, int scale) Build a Javalongfrom a fixed point decimal byte representation.private static final intpackedNybblesToInt(byte[] buffer, int offset, int startNybble, int numberOfNybbles) Convert a range of packed nybbles (up to 9 digits without overflow) to an int.private static final longpackedNybblesToLong(byte[] buffer, int offset, int startNybble, int numberOfNybbles) Convert a range of packed nybbles (up to 18 digits without overflow) to a long.
-
Field Details
-
PACKED_DECIMAL
public static final int PACKED_DECIMALPacked Decimal representation- See Also:
-
msgutil
-
tenRadixMagnitude
private static final int[][] tenRadixMagnitude
-
-
Constructor Details
-
Decimal
private Decimal()
-
-
Method Details
-
packedNybblesToInt
private static final int packedNybblesToInt(byte[] buffer, int offset, int startNybble, int numberOfNybbles) Convert a range of packed nybbles (up to 9 digits without overflow) to an int. Note that for performance purpose, it does not do array-out-of-bound checking. -
packedNybblesToLong
private static final long packedNybblesToLong(byte[] buffer, int offset, int startNybble, int numberOfNybbles) Convert a range of packed nybbles (up to 18 digits without overflow) to a long. Note that for performance purpose, it does not do array-out-of-bound checking. -
computeMagnitude
private static final int[] computeMagnitude(int[] input) Compute the int array of magnitude from input value segments. -
getBigDecimal
Build ajava.math.BigDecimalfrom a fixed point decimal byte representation.- Throws:
IllegalArgumentException- if the specified representation is not recognized.
-
getDouble
static double getDouble(byte[] buffer, int offset, int precision, int scale) Build a Javadoublefrom a fixed point decimal byte representation.- Throws:
IllegalArgumentException- if the specified representation is not recognized.
-
getLong
static long getLong(byte[] buffer, int offset, int precision, int scale) Build a Javalongfrom a fixed point decimal byte representation.- Throws:
IllegalArgumentException- if the specified representation is not recognized.ArithmeticException- if value is too large for a long
-
bigDecimalToPackedDecimalBytes
public static final int bigDecimalToPackedDecimalBytes(byte[] buffer, int offset, BigDecimal b, int declaredPrecision, int declaredScale) throws SqlException Write a Javajava.math.BigDecimalto packed decimal bytes.- Throws:
SqlException
-