The AS400BidiTransform
class provides layout transformations that allow the conversion of bidi text
in AS/400 format (after its conversion to Unicode) to Bidi text in Java format,
or from Java format to AS/400 format. The default conversion is based on the
CCSID of the job. To alter the direction and shaping of the text, specify a
BidiStringType.
Note that where AS/400 Toolbox for Java objects perform the conversion internally,
as in the DataArea class, the objects have a method to override the string type.
For example, the DataArea class has addVetoableChangeListener() method that
you can specify to listen for a veto changes to certain properties, including
string type.
For example, assume that a DataQueueEntry object returns AS/400 text in EBCDIC. The following example converts this data to unicode so that the Java program can use it:
// ... Assume the data queues work // has already been done to retrieve // the text from the AS/400 and the // data has been put in the // following buffer. int textLength = 100; byte[] data = new byte[textLength]; // Create a converter for the AS/400 // data type. Note a default // converter is being built. This // converter assumes the AS/400 // EBCDIC code page matches the // client's locale. If this is not // true the Java program can // explicitly specify the EBCDIC // ccsid to use. AS400Text textConverter = new AS400Text(textLength); // Convert the data from EBCDIC to // unicode. String javaText = (String) textConverter.toObject(data);