com.servingxml.util.record
Class PackedDecimal

java.lang.Object
  extended by com.servingxml.util.record.PackedDecimal

public class PackedDecimal
extends java.lang.Object


Field Summary
protected  byte[] data
           
 
Constructor Summary
PackedDecimal(byte[] data, int digitCount, int decimalPlaces)
          Constructs a newly allocated PackedDecimal object from a byte array.
 
Method Summary
static int calculatePackedSize(int digitCount)
           
 int decimalPlaces()
           
 int digitCount()
           
 byte[] getPackedData()
           
static PackedDecimal parse(java.lang.String s, int digitCount, int decimalPlaces)
          Returns a new PackedDecimal initialized to the value represented by the specified String
 java.lang.String toString()
          Returns a string representation of this packed decimal object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected byte[] data
Constructor Detail

PackedDecimal

public PackedDecimal(byte[] data,
                     int digitCount,
                     int decimalPlaces)
Constructs a newly allocated PackedDecimal object from a byte array.

Parameters:
data - byte array containing a COBOL packed decimal number
digitCount - the total number of digits in the packed decimal number
decimalPlaces - the number of places to the right of the implied decimal
Method Detail

digitCount

public int digitCount()

decimalPlaces

public int decimalPlaces()

getPackedData

public byte[] getPackedData()

calculatePackedSize

public static int calculatePackedSize(int digitCount)

parse

public static PackedDecimal parse(java.lang.String s,
                                  int digitCount,
                                  int decimalPlaces)
                           throws java.lang.NumberFormatException
Returns a new PackedDecimal initialized to the value represented by the specified String

Parameters:
s - the string to be parsed
digitCount - the total number of digits in the packed decimal number
decimalPlaces - the number of places to the right of the implied decimal
Throws:
java.lang.NumberFormatException

toString

public java.lang.String toString()
Returns a string representation of this packed decimal object

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this packed decimal object