The
AS400BidiTransform class provides layout transformations that allow the
conversion of bidirectional text in iSeries format (after its conversion to
Unicode) to bidirectional text in Java format, or from Java format to iSeries
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 IBM 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 iSeries 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 iSeries and the // data has been put in the // following buffer. int textLength = 100; byte[] data = new byte[textLength]; // Create a converter for the iSeries // data type. Note a default // converter is being built. This // converter assumes the iSeries // 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);