|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bankframe.ei.txnhandler.dataformat.DataFormatUtils
public class DataFormatUtils
This class is a utility class providing common methods for manipulating numerical data in Cobol and hex formats
| Field Summary | |
|---|---|
static char |
CHAR_MINUS
|
static char |
CHAR_PERIOD
|
static char |
CHAR_PLUS
|
static byte |
INTEGER
|
static byte |
SHORT
|
| Constructor Summary | |
|---|---|
DataFormatUtils()
This method is the default constructor for the DataFormatUtils class. |
|
| Method Summary | |
|---|---|
static String |
asciiToString(byte[] ascii)
This method converts an ASCII string to java.lang.String format |
static String |
cobolNumberToString(byte[] input,
String fieldEncoding,
boolean isSigned,
int decBefore,
int decAfter)
This method converts a Cobol number in the byte array into a text String using the specified encoding. |
static String |
comp3ToString(byte[] input,
int numWholeDigits,
int numFractionalDigits)
This method converts an COBOL COMP3 number to java.lang.String format |
static String |
compToString(byte[] input)
This method converts an COBOL COMP number to java.lang.String format |
static String |
ebcdicToString(byte[] ebcdic)
This method converts an EBCDIC string to java.lang.String format |
static byte[] |
hexStringToBytes(String input)
This method converts a hex String representation to byte array |
static boolean |
isSigned(String sign)
This method determines if the given string flag indicates a signed number has been specified. |
static boolean |
padRight(String fillAlignment)
This method determines if the given string flag indicates right-padding has been specified. |
static String |
standardToString(byte[] input,
int numWholeDigits,
int numFractionalDigits)
This method converts a COBOL standard number to java.lang.String format |
static byte[] |
subset(byte[] data,
int startIndex,
int endIndex)
This method gets a subset of the specified byte array |
static byte[] |
toAscii(String input)
This method converts an java.lang.String to ascii bytes |
static byte[] |
toCobolNumber(String input,
String fieldEncoding,
boolean isSigned,
int decBefore,
int decAfter)
This method converts a number into a Cobol number in a byte array using the specified encoding. |
static byte[] |
toComp(String input,
boolean signed,
int inputSize)
This method converts a numerical string to a COBOL COMP number |
static byte[] |
toComp3(String input,
boolean signed,
int maxWholeDigits,
int maxFractionalDigits)
This method converts a numerical string to COBOL COMP3 |
static byte[] |
toEbcdic(String input)
This method converts a string to EBCDIC encoding |
static void |
toHex(byte[] input,
StringBuffer buffer)
This method creates a hex representation of the given byte array. |
static void |
toHex(byte input,
StringBuffer buffer)
This method creates a hex representation of the given byte |
static void |
toHex(int input,
StringBuffer buffer)
This method creates a hex representation of the given integer. |
static String |
toHexDump(byte[] input)
This method produces a hex dump of the specified byte array |
static String |
toHexString(byte input)
This method creates a hex representation of the given byte |
static String |
toHexString(byte[] input)
This method creates a hex representation of the given byte array. |
static String |
toHexString(int input)
This method creates a hex representation of the given integer. |
static byte[] |
toStandard(String input,
boolean signed,
int maxWholeDigits,
int maxFractionalDigits)
This method converts a numerical string to a COBOL standard |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte INTEGER
public static final byte SHORT
public static final char CHAR_MINUS
public static final char CHAR_PLUS
public static final char CHAR_PERIOD
| Constructor Detail |
|---|
public DataFormatUtils()
| Method Detail |
|---|
public static boolean padRight(String fillAlignment)
fillAlignment - is the String to check
public static boolean isSigned(String sign)
sign - is the String to check
public static String cobolNumberToString(byte[] input,
String fieldEncoding,
boolean isSigned,
int decBefore,
int decAfter)
input - is a byte array containing a Cobol number to convertfieldEncoding - is the encoding format of the Cobol number input; STD, COMP3, COMP, XisSigned - indicates if the Cobol number is signeddecBefore - indicates the number of places before the decimal pointdecAfter - indicates the number of places after the decimal point
public static byte[] toCobolNumber(String input,
String fieldEncoding,
boolean isSigned,
int decBefore,
int decAfter)
input - contains the number to convert into a Cobol number formatfieldEncoding - is the encoding format to use for the Cobol number; STD, COMP3, COMP, XisSigned - indicates if the Cobol number is signeddecBefore - indicates the number of places before the decimal pointdecAfter - indicates the number of places after the decimal point
public static void toHex(byte input,
StringBuffer buffer)
input - is the byte to represent in hexbuffer - is a StringBuffer containing the hex representation of the bytepublic static String toHexString(byte input)
input - is the byte to represent in hex
public static void toHex(byte[] input,
StringBuffer buffer)
input - is the byte array to represent in hexbuffer - is a StringBuffer containing the hex representation of the byte arraypublic static String toHexString(byte[] input)
input - is the byte array to represent in hex
public static void toHex(int input,
StringBuffer buffer)
input - is the integer to represent in hexbuffer - is a StringBuffer containing the hex representation of the integerpublic static String toHexString(int input)
input - is the integer to represent in hex
public static String toHexDump(byte[] input)
input - is the byte[] to create a hex dump from
public static byte[] hexStringToBytes(String input)
input - is the hex String
public static byte[] toEbcdic(String input)
input - is String to convert
public static byte[] toAscii(String input)
input - is String to convert
public static String asciiToString(byte[] ascii)
ascii - byte array
public static String ebcdicToString(byte[] ebcdic)
ebcdic - byte array to convert
public static String compToString(byte[] input)
input - is a Cobol number byte array
public static byte[] toComp(String input,
boolean signed,
int inputSize)
input - is the numerical stringsigned - indicates if the number is signedinputSize - indicates the size of the Cobol number
public static String comp3ToString(byte[] input,
int numWholeDigits,
int numFractionalDigits)
input - is the Cobol byte arraynumWholeDigits - is the number of places before decimal pointnumFractionalDigits - is the number of places after decimal point
public static byte[] toComp3(String input,
boolean signed,
int maxWholeDigits,
int maxFractionalDigits)
input - is the numerical stringsigned - indicates if the number is signedmaxWholeDigits - is the number of places before decimal pointmaxFractionalDigits - is the number of places after decimal point
public static String standardToString(byte[] input,
int numWholeDigits,
int numFractionalDigits)
input - is the Cobol byte arraynumWholeDigits - is the number of places before decimal pointnumFractionalDigits - is the number of places after decimal point
public static byte[] toStandard(String input,
boolean signed,
int maxWholeDigits,
int maxFractionalDigits)
input - is the numerical stringsigned - indicates if the number is signedmaxWholeDigits - is the number of places before decimal pointmaxFractionalDigits - is the number of places after decimal point
public static byte[] subset(byte[] data,
int startIndex,
int endIndex)
data - is the byte array to get a subset ofstartIndex - is the start index of the required subsetendIndex - is the end index of the required subset
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||