com.ibm.bidiTools.bdlayout
Class BidiConvert

java.lang.Object
  extended by com.ibm.bidiTools.bdlayout.BidiConvert

public class BidiConvert
extends java.lang.Object

BidiConvert is a convenience class to facilitate invocation of the Bidi layout transformations by converter code in the JVM.

It contains 2 public methods: toUnicode() and toSbcs().

Method toUnicode() must be called by the ByteToChar converters after converting the SBCS byte data into Unicode.

Method toSbcs() must be called by the CharToByte converters before converting the Unicode string data into byte data.


Constructor Summary
BidiConvert()
           
 
Method Summary
 boolean isBidiData(char[] input, int inStart, int inEnd, java.lang.String bidiParms, java.lang.String encoding)
          This method checks if a char array needs Bidi transformation.
 boolean isBidiData(java.nio.CharBuffer input, boolean UseBuffer, java.lang.String bidiParms, java.lang.String encoding)
          This method checks if a CharBuffer needs Bidi transformation.
 boolean isBidiData(java.lang.String input, java.lang.String bidiParms, java.lang.String encoding)
          This method checks if a string needs Bidi transformation.
 boolean isBidiEnv(java.lang.String bidiParms, java.lang.String encoding)
          This method checks if the environment allows Bidi transformations for the current encoding.
 char[] toSbcs(char[] input, int inStart, int inEnd, java.lang.String bidiParms, java.lang.String encoding)
          This method converts a char array from the Bidi attributes used inside the JVM to those used outside the JVM.
 java.nio.CharBuffer toSbcs(java.nio.CharBuffer input, boolean UseBuffer, java.lang.String bidiParms, java.lang.String encoding)
          This method converts a CharBuffer from the Bidi attributes used inside the JVM to those used outside the JVM.
 java.lang.String toSbcs(java.lang.String input, java.lang.String bidiParms, java.lang.String encoding)
          This method converts a string from the Bidi attributes used inside the JVM to those used outside the JVM.
 char[] toUnicode(char[] input, int inStart, int inEnd, java.lang.String bidiParms, java.lang.String encoding)
          This method converts a char array from the Bidi attributes used outside the JVM to those used inside the JVM.
 java.nio.CharBuffer toUnicode(java.nio.CharBuffer input, boolean UseBuffer, java.lang.String bidiParms, java.lang.String encoding)
          This method converts a CharBuffer from the Bidi attributes used outside the JVM to those used inside the JVM.
 java.lang.String toUnicode(java.lang.String input, java.lang.String bidiParms, java.lang.String encoding)
          This method converts a string from the Bidi attributes used outside the JVM to those used inside the JVM.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BidiConvert

public BidiConvert()
Method Detail

isBidiEnv

public boolean isBidiEnv(java.lang.String bidiParms,
                         java.lang.String encoding)
This method checks if the environment allows Bidi transformations for the current encoding.

Parameters:
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
true if the environment allows Bidi transformations for the current encoding.

isBidiData

public boolean isBidiData(char[] input,
                          int inStart,
                          int inEnd,
                          java.lang.String bidiParms,
                          java.lang.String encoding)
This method checks if a char array needs Bidi transformation.

Parameters:
input - The input char array containing text in Unicode.
inStart - Offset in input array.
inEnd - Offset of last byte to be converted.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
true if the string needs Bidi transformation.

isBidiData

public boolean isBidiData(java.lang.String input,
                          java.lang.String bidiParms,
                          java.lang.String encoding)
This method checks if a string needs Bidi transformation.

Parameters:
input - The input string.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
true if the string needs Bidi transformation.

isBidiData

public boolean isBidiData(java.nio.CharBuffer input,
                          boolean UseBuffer,
                          java.lang.String bidiParms,
                          java.lang.String encoding)
This method checks if a CharBuffer needs Bidi transformation.

Parameters:
input - The input buffer.
UseBuffer - flag to prevent use of char array in CharBuffer.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
true if the buffer needs Bidi transformation.

toUnicode

public char[] toUnicode(char[] input,
                        int inStart,
                        int inEnd,
                        java.lang.String bidiParms,
                        java.lang.String encoding)
This method converts a char array from the Bidi attributes used outside the JVM to those used inside the JVM.

Parameters:
input - The input char array.
inStart - Offset in input array.
inEnd - Offset of last byte to be converted.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
The input char array transformed to the layout specified by bidiParms.

toUnicode

public java.lang.String toUnicode(java.lang.String input,
                                  java.lang.String bidiParms,
                                  java.lang.String encoding)
This method converts a string from the Bidi attributes used outside the JVM to those used inside the JVM.

Parameters:
input - The input string.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
The input string transformed to the layout specified by bidiParms.

toUnicode

public java.nio.CharBuffer toUnicode(java.nio.CharBuffer input,
                                     boolean UseBuffer,
                                     java.lang.String bidiParms,
                                     java.lang.String encoding)
This method converts a CharBuffer from the Bidi attributes used outside the JVM to those used inside the JVM.

Parameters:
input - The input buffer.
UseBuffer - flag to prevent use of char array in CharBuffer.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
another CharBuffer with its data input string transformed to the layout specified by bidiParms.

toSbcs

public char[] toSbcs(char[] input,
                     int inStart,
                     int inEnd,
                     java.lang.String bidiParms,
                     java.lang.String encoding)
This method converts a char array from the Bidi attributes used inside the JVM to those used outside the JVM.

Parameters:
input - The input char array.
inStart - Offset in input array.
inEnd - Offset of last byte to be converted.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
The input char array transformed to the layout specified by bidiParms.

toSbcs

public java.lang.String toSbcs(java.lang.String input,
                               java.lang.String bidiParms,
                               java.lang.String encoding)
This method converts a string from the Bidi attributes used inside the JVM to those used outside the JVM.

Parameters:
input - The input string.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
The input string transformed to the layout specified by bidiParms.

toSbcs

public java.nio.CharBuffer toSbcs(java.nio.CharBuffer input,
                                  boolean UseBuffer,
                                  java.lang.String bidiParms,
                                  java.lang.String encoding)
This method converts a CharBuffer from the Bidi attributes used inside the JVM to those used outside the JVM.

Parameters:
input - The input buffer.
UseBuffer - flag to prevent use of char array in CharBuffer.
bidiParms - The environment variable containing the specifications of the Bidi attributes.
encoding - The encoding of the data outside the JVM.
Returns:
another CharBuffer with its data input string transformed to the layout specified by bidiParms.