Top Description Fields Constructors Methods
org.apache.derby.client.am

public Class Decimal

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.i18n.MessageUtil

Converters from fixed point decimal bytes to java.math.BigDecimal, double, or long.

Field Summary

Modifier and TypeField and Description
private static final MessageUtil
public static final int
PACKED_DECIMAL

Packed Decimal representation

private static final int[][]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static final int

Returns:

the number of bytes written
bigDecimalToPackedDecimalBytes
(byte[]
Buffer to which to write the packed decimal
buffer
,
int
Offset into the buffer at which to write
offset
,
BigDecimal
The BigDecimal to write
b
,
int
Its precision
declaredPrecision
,
int
Its scale
declaredScale
)

Write a Java java.math.BigDecimal to packed decimal bytes.

private static final int[]
computeMagnitude(int[] input)

Compute the int array of magnitude from input value segments.

pack-priv static BigDecimal
getBigDecimal(byte[] buffer, int offset, int precision, int scale)

Build a java.math.BigDecimal from a fixed point decimal byte representation.

pack-priv static double
getDouble(byte[] buffer, int offset, int precision, int scale)

Build a Java double from a fixed point decimal byte representation.

pack-priv static long
getLong(byte[] buffer, int offset, int precision, int scale)

Build a Java long from a fixed point decimal byte representation.

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.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

msgutilback to summary
private static final MessageUtil msgutil
PACKED_DECIMALback to summary
public static final int PACKED_DECIMAL

Packed Decimal representation

tenRadixMagnitudeback to summary
private static final int[][] tenRadixMagnitude

Constructor Detail

Decimalback to summary
private Decimal()

Method Detail

bigDecimalToPackedDecimalBytesback to summary
public static final int bigDecimalToPackedDecimalBytes(byte[] buffer, int offset, BigDecimal b, int declaredPrecision, int declaredScale) throws SqlException

Write a Java java.math.BigDecimal to packed decimal bytes.

Parameters
buffer:byte[]

Buffer to which to write the packed decimal

offset:int

Offset into the buffer at which to write

b:BigDecimal

The BigDecimal to write

declaredPrecision:int

Its precision

declaredScale:int

Its scale

Returns:int

the number of bytes written

Exceptions
SqlException:
on error
computeMagnitudeback to summary
private static final int[] computeMagnitude(int[] input)

Compute the int array of magnitude from input value segments.

getBigDecimalback to summary
pack-priv static BigDecimal getBigDecimal(byte[] buffer, int offset, int precision, int scale)

Build a java.math.BigDecimal from a fixed point decimal byte representation.

Exceptions
IllegalArgumentException:
if the specified representation is not recognized.
getDoubleback to summary
pack-priv static double getDouble(byte[] buffer, int offset, int precision, int scale)

Build a Java double from a fixed point decimal byte representation.

Exceptions
IllegalArgumentException:
if the specified representation is not recognized.
getLongback to summary
pack-priv static long getLong(byte[] buffer, int offset, int precision, int scale)

Build a Java long from a fixed point decimal byte representation.

Exceptions
IllegalArgumentException:
if the specified representation is not recognized.
ArithmeticException:
if value is too large for a long
packedNybblesToIntback to summary
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.

packedNybblesToLongback to summary
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.