Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.verifiers.comm.bridge
Class DataConversionStaticHelpers

java.lang.Object
  extended by com.ibm.etools.iseries.edit.verifiers.comm.bridge.DataConversionStaticHelpers

public class DataConversionStaticHelpers
extends Object

This class contains static methods for converting Java data types to the corresponding C data types. Here is the mapping table Java datatype C datatype C datatype lenght (bytes) short short 2 int unsigned short 2 int int 4 long unsigned int 4 int long 4 long unsigned long 4 char char 1 char unsigned char 1


Field Summary
static String copyright
           
 
Method Summary
static char cCharToJavaChar(byte buffer)
          Convert a C char to Java char
static int cIntToJavaInt(byte[] buffer)
          Convert a C int to Java int
static int cLongToJavaInt(byte[] buffer)
          Convert a C long to Java int
static short cShortToJavaShort(byte[] buffer)
          Convert a C short to Java short.
static String cStringToJavaString(byte[] buffer)
          Convert a C char array (string) to Java String
static char cUnsignedCharToJavaChar(byte buffer)
          Convert a C unsigned char to Java char
static long cUnsignedIntToJavaLong(byte[] buffer)
          Convert a C unsigned int to Java long
static long cUnsignedLongToJavaLong(byte[] buffer)
          Convert a C unsigned long to Java long
static int cUnsignedShortToJavaInt(byte[] buffer)
          Convert a C unsigned short to Java int
static String insertShiftInShiftOut(String source)
          Insert the shift in / shift out characters for Strings which contain DBCS characters.
static byte javaCharToCChar(char value)
          Convert a 2 byte Unicode character to a 1 byte C char
static byte javaCharToCUnsignedChar(char value)
          Convert a 2 byte Unicode character to a 1 byte unsigned C char
static byte[] javaIntToCInt(int value)
          Convert a Java int to a C int.
static byte[] javaIntToCLong(int value)
          Convert a Java int to a C long (in C longs are only 4 bytes which is equivalent to a Java int)
static byte[] javaIntToCUnsignedShort(int value)
          Convert a Java int to a C unsigned short.
static byte[] javaLongToCUnsignedInt(long value)
          Convert a Java long to a C unsigned int.
static byte[] javaLongToCUnsignedLong(long value)
          Convert a Java long to a C unsigned long.
static byte[] javaShortToCShort(short value)
          Convert a Java short to C short.
static byte[] javaStringToCCharArray(String value)
          Convert a Java Unicode string to a C char array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values
Method Detail

javaShortToCShort

public static byte[] javaShortToCShort(short value)
Convert a Java short to C short.


javaIntToCUnsignedShort

public static byte[] javaIntToCUnsignedShort(int value)
Convert a Java int to a C unsigned short. A Java int is required because there are no unsigned integers in Java. Only the 2 low order bytes are sent.


javaIntToCInt

public static byte[] javaIntToCInt(int value)
Convert a Java int to a C int.


javaLongToCUnsignedInt

public static byte[] javaLongToCUnsignedInt(long value)
Convert a Java long to a C unsigned int. A Java long is required because there are no unsigned integers in Java. Only the 4 low order bytes are sent.


javaIntToCLong

public static byte[] javaIntToCLong(int value)
Convert a Java int to a C long (in C longs are only 4 bytes which is equivalent to a Java int)


javaLongToCUnsignedLong

public static byte[] javaLongToCUnsignedLong(long value)
Convert a Java long to a C unsigned long.


javaCharToCChar

public static byte javaCharToCChar(char value)
Convert a 2 byte Unicode character to a 1 byte C char


javaCharToCUnsignedChar

public static byte javaCharToCUnsignedChar(char value)
Convert a 2 byte Unicode character to a 1 byte unsigned C char


javaStringToCCharArray

public static byte[] javaStringToCCharArray(String value)
Convert a Java Unicode string to a C char array


cShortToJavaShort

public static short cShortToJavaShort(byte[] buffer)
Convert a C short to Java short.

Parameters:
buffer - byte array containing the c short value. The array must have a length >= 2. If the length > 2 only the first two bytes are used.

cUnsignedShortToJavaInt

public static int cUnsignedShortToJavaInt(byte[] buffer)
Convert a C unsigned short to Java int


cIntToJavaInt

public static int cIntToJavaInt(byte[] buffer)
Convert a C int to Java int


cUnsignedIntToJavaLong

public static long cUnsignedIntToJavaLong(byte[] buffer)
Convert a C unsigned int to Java long


cLongToJavaInt

public static int cLongToJavaInt(byte[] buffer)
Convert a C long to Java int


cUnsignedLongToJavaLong

public static long cUnsignedLongToJavaLong(byte[] buffer)
Convert a C unsigned long to Java long


cCharToJavaChar

public static char cCharToJavaChar(byte buffer)
Convert a C char to Java char


cUnsignedCharToJavaChar

public static char cUnsignedCharToJavaChar(byte buffer)
Convert a C unsigned char to Java char


cStringToJavaString

public static String cStringToJavaString(byte[] buffer)
Convert a C char array (string) to Java String


insertShiftInShiftOut

public static String insertShiftInShiftOut(String source)
Insert the shift in / shift out characters for Strings which contain DBCS characters.


Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.