IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.samples.business.sna.util
Class DummyJavaExtensions

java.lang.Object
  extended bycom.ibm.btt.samples.business.sna.util.DummyJavaExtensions

public class DummyJavaExtensions
extends java.lang.Object

This class contains utility methods.


Constructor Summary
DummyJavaExtensions()
           
 
Method Summary
static java.lang.String addAttribute(java.lang.String s, java.lang.String name, java.lang.String value)
          Concatenates strings as appropriate.
static long charArrayToLong(char[] charArray)
          Returns the long value of charArray.
static java.lang.String compressHexString(byte[] input)
          Compresses a byte array into Hexadecimal format.
static java.lang.String compressHexString(java.lang.String aString)
          Compresses a String into Hexadecimal format.
static java.lang.String convertFromEBCDIC(java.lang.String aString)
          Converts a String from EBCDIC.
static java.lang.String convertFromEBCDIC(java.lang.String aString, java.lang.String codeSet)
          Converts a String from EBCDIC.
static java.lang.String convertToEBCDIC(java.lang.String aString)
          Converts a String to EBCDIC.
static java.lang.String convertToEBCDIC(java.lang.String aString, java.lang.String codeSet)
          Converts a String to EBCDIC.
static java.lang.String decompressHexString(byte[] input)
          Decompresses a byte array from Hexadecimal format.
static java.lang.String decompressHexString(java.lang.String aString)
          Decompresses a String from Hexadecimal format.
static java.lang.String doubleQuote(java.lang.String aString)
          Puts a string between double quotes.
static java.lang.String fill(java.lang.String aString, char paddingChar, int finalLength, boolean rigthSide)
          Adds a paddingChar to the right or left (determined by the rightSide parameter) of a String until its length equals the value of the finalLength parameter.
static java.lang.String fillLeft(java.lang.String aString, char paddingChar, int finalLength)
          Adds a paddingChar to the left of aString until its length equals the value of the finalLength parameter.
static java.lang.String fillRigth(java.lang.String aString, char paddingChar, int finalLength)
          Adds a paddingChar to the right of aString until its length equals the value of the finalLength parameter.
protected static byte[] generateUniqueCode(java.lang.String userString)
          This method returns an unique code, and implies the given String in the process of generation.
static java.lang.String getAlphaUniqueCode()
          This method returns an unique code which result are only alphanumberic characters.
static java.lang.String getAlphaUniqueCode(java.lang.String userString)
          This method returns an unique code which result are only alphanumberic characters, and implies the given String in the process of generation.
static java.lang.String getCodePage()
          Gets the codepage
static java.lang.String getCodeSet()
          Gets the codeSet
static java.lang.String getEncryptionAlgorithm()
          Gets the encryptionAlgorithm
static java.lang.String getLocalHost()
          This method returns the local host IP address.
static char getSeparator()
          Gets the separator
static java.lang.String getUniqueCode()
          This method returns an unique code.
static java.lang.String getUniqueCode(java.lang.String userString)
          This method returns an unique code, and implies the given String in the process of generation.
static boolean isEmpty(java.lang.String aString)
          Returns true if the parameter string is null or is an empty string.
static char[] longAsCharArray(int base, long value)
          Returns the bytes as a char array of the long value.
static long remainder(long number, long divider)
          Returns the remainder of a division between two longs.
static void setCodePage(java.lang.String codePage)
          Sets the codepage
static void setCodeSet(java.lang.String codeSet)
          Sets the codeSet
static void setEncryptionAlgorithm(java.lang.String encryptionAlgorithm)
          Sets the encryptionAlgorithm
static void setSeparator(char separator)
          Sets the separator
static long signedCharArrayToLong(char[] aCharArray)
          Returns a char[] array as a long.
static void sortStrings(java.lang.String[] strings)
          Sorts an array of Strings.
static java.lang.String stringReplace(java.lang.String source, java.lang.String oldString, java.lang.String newString)
          Returns a new string resulting from replacing all occurrences of oldString in source with newString.
static int unsignedValue(byte aByte)
          Returns a positive value of a byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyJavaExtensions

public DummyJavaExtensions()
Method Detail

addAttribute

public static java.lang.String addAttribute(java.lang.String s,
                                            java.lang.String name,
                                            java.lang.String value)
Concatenates strings as appropriate.

Parameters:
s - java.lang.String
name - java.lang.String
value - java.lang.String
Returns:
java.lang.String

charArrayToLong

public static long charArrayToLong(char[] charArray)
Returns the long value of charArray. Assume that the array is a 'charArray.length'-byte 2's complement integer(0-less weigth).

Parameters:
charArray - char[]
Returns:
long

compressHexString

public static java.lang.String compressHexString(byte[] input)
Compresses a byte array into Hexadecimal format.

Parameters:
input - byte[]
Returns:
java.lang.String

compressHexString

public static java.lang.String compressHexString(java.lang.String aString)
Compresses a String into Hexadecimal format.

Parameters:
aString - java.lang.String
Returns:
string

convertFromEBCDIC

public static java.lang.String convertFromEBCDIC(java.lang.String aString)
Converts a String from EBCDIC.

Parameters:
aString - java.lang.String
Returns:
java.lang.String

convertFromEBCDIC

public static java.lang.String convertFromEBCDIC(java.lang.String aString,
                                                 java.lang.String codeSet)
                                          throws java.io.UnsupportedEncodingException
Converts a String from EBCDIC.

Parameters:
aString - java.lang.String
codeSet - java.lang.String
Returns:
java.lang.String
Throws:
java.io.UnsupportedEncodingException

convertToEBCDIC

public static java.lang.String convertToEBCDIC(java.lang.String aString)
Converts a String to EBCDIC.

Parameters:
aString - java.lang.String
Returns:
java.lang.String

convertToEBCDIC

public static java.lang.String convertToEBCDIC(java.lang.String aString,
                                               java.lang.String codeSet)
                                        throws java.io.UnsupportedEncodingException
Converts a String to EBCDIC.

Parameters:
aString - java.lang.String
codeSet - java.lang.String
Returns:
java.lang.String
Throws:
java.io.UnsupportedEncodingException

decompressHexString

public static java.lang.String decompressHexString(byte[] input)
Decompresses a byte array from Hexadecimal format.

Parameters:
input - byte[]
Returns:
java.lang.String

decompressHexString

public static java.lang.String decompressHexString(java.lang.String aString)
Decompresses a String from Hexadecimal format.

Parameters:
aString - java.lang.String
Returns:
java.lang.String

doubleQuote

public static java.lang.String doubleQuote(java.lang.String aString)
Puts a string between double quotes.

Parameters:
aString - java.lang.String
Returns:
java.lang.String

fill

public static java.lang.String fill(java.lang.String aString,
                                    char paddingChar,
                                    int finalLength,
                                    boolean rigthSide)
Adds a paddingChar to the right or left (determined by the rightSide parameter) of a String until its length equals the value of the finalLength parameter.

Parameters:
aString - java.lang.String
paddingChar - char
finalLength - int
rigthSide - boolean
Returns:
java.lang.String

fillLeft

public static java.lang.String fillLeft(java.lang.String aString,
                                        char paddingChar,
                                        int finalLength)
Adds a paddingChar to the left of aString until its length equals the value of the finalLength parameter.

Parameters:
aString - java.lang.String
paddingChar - char
finalLength - int
Returns:
java.lang.String

fillRigth

public static java.lang.String fillRigth(java.lang.String aString,
                                         char paddingChar,
                                         int finalLength)
Adds a paddingChar to the right of aString until its length equals the value of the finalLength parameter.

Parameters:
aString - java.lang.String
paddingChar - char
finalLength - int

generateUniqueCode

protected static byte[] generateUniqueCode(java.lang.String userString)
This method returns an unique code, and implies the given String in the process of generation.

Parameters:
userString - java.lang.String
Returns:
java.lang.String

getAlphaUniqueCode

public static java.lang.String getAlphaUniqueCode()
This method returns an unique code which result are only alphanumberic characters.

Returns:
java.lang.String

getAlphaUniqueCode

public static java.lang.String getAlphaUniqueCode(java.lang.String userString)
This method returns an unique code which result are only alphanumberic characters, and implies the given String in the process of generation.

Parameters:
userString - java.lang.String
Returns:
java.lang.String

getLocalHost

public static java.lang.String getLocalHost()
This method returns the local host IP address.

Returns:
java.lang.String

getUniqueCode

public static java.lang.String getUniqueCode()
This method returns an unique code.

Returns:
java.lang.String

getUniqueCode

public static java.lang.String getUniqueCode(java.lang.String userString)
This method returns an unique code, and implies the given String in the process of generation.

Parameters:
userString - java.lang.String
Returns:
java.lang.String

isEmpty

public static boolean isEmpty(java.lang.String aString)
Returns true if the parameter string is null or is an empty string.

Parameters:
aString - java.lang.String
Returns:
boolean

longAsCharArray

public static char[] longAsCharArray(int base,
                                     long value)
Returns the bytes as a char array of the long value. Assumes that the long value is a 'base'-byte 2's complement integer. Notice that if base == 8 the answer is the internal byte-representation of the standard-Java long value, for base == 4 the int, for base == 2 the short, and base == 1 the byte. Returns a long as a char[] array. This method assumes that the long value a 'base'-byte 2's complement integer . The base parameter determines the how the long is returned: 8 ==> internal byte-representation of the standard Java long value. 4 ==> int representation. 2 ==> short representation. 1 ==> byte representation.


remainder

public static long remainder(long number,
                             long divider)
Returns the remainder of a division between two longs.

Parameters:
number - long
divider - long
Returns:
long

signedCharArrayToLong

public static long signedCharArrayToLong(char[] aCharArray)
Returns a char[] array as a long. This method assumes that the array is a 'charArray.length'-byte 2's complement integer(0-less weigth).

Parameters:
aCharArray - char[]
Returns:
long

sortStrings

public static void sortStrings(java.lang.String[] strings)
Sorts an array of Strings.


stringReplace

public static java.lang.String stringReplace(java.lang.String source,
                                             java.lang.String oldString,
                                             java.lang.String newString)
Returns a new string resulting from replacing all occurrences of oldString in source with newString. If the string oldString does not occur in source, then source string is returned.

Parameters:
source - java.lang.String the source string.
oldString - java.lang.String the old string.
newString - java.lang.String the new string.
Returns:
java.lang.String a string derived from source string by replacing every occurrence of oldString with newString.

unsignedValue

public static int unsignedValue(byte aByte)
Returns a positive value of a byte.

Parameters:
aByte - byte
Returns:
int

getCodePage

public static java.lang.String getCodePage()
Gets the codepage

Returns:
Returns a String

setCodePage

public static void setCodePage(java.lang.String codePage)
                        throws java.io.UnsupportedEncodingException
Sets the codepage

Parameters:
codePage - The codepage to set
Throws:
java.io.UnsupportedEncodingException

getCodeSet

public static java.lang.String getCodeSet()
Gets the codeSet

Returns:
Returns a String

setCodeSet

public static void setCodeSet(java.lang.String codeSet)
                       throws java.io.UnsupportedEncodingException
Sets the codeSet

Parameters:
codeSet - The codeSet to set
Throws:
java.io.UnsupportedEncodingException

getSeparator

public static char getSeparator()
Gets the separator

Returns:
Returns a char

setSeparator

public static void setSeparator(char separator)
Sets the separator

Parameters:
separator - The separator to set

getEncryptionAlgorithm

public static java.lang.String getEncryptionAlgorithm()
Gets the encryptionAlgorithm

Returns:
Returns a String

setEncryptionAlgorithm

public static void setEncryptionAlgorithm(java.lang.String encryptionAlgorithm)
Sets the encryptionAlgorithm

Parameters:
encryptionAlgorithm - The encryptionAlgorithm to set

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005