Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.util
Class EbcdicStringIterator

java.lang.Object
  extended by com.ibm.etools.iseries.util.EbcdicStringIterator
All Implemented Interfaces:
IEbcdicStringIterator

public class EbcdicStringIterator
extends Object
implements IEbcdicStringIterator

This class allows you to split up a Unicode string into pieces of arbitrary lengths that are specified in EBCDIC byte lengths

Example

Take the following example where uppercase is Chinese and lower case is English aBCd in EBCDIC is [B1B2C1C2]d If we are wrapping this field on a 24x80 screen and the field begins at 75, we have room for 6 bytes on the first line. The first 5 bytes are a [B1B2 but this would not be valid without a closing shift. So we really want a (note the need to pad) and put the B1B1C1C2]d on the next line. If we would have used simple substring we would have gotten a [B1B2] and [C1C2]d which would have been wrong.


Constructor Summary
EbcdicStringIterator(String unicodeString, int ccsid, boolean isPureDbcs)
          Allow the given string to be split up into chunk based on EBCDIC byte lengths
EbcdicStringIterator(String unicodeString, int ccsid, boolean isPureDbcs, boolean wantShiftsEmbedded)
           
 
Method Summary
 IEbcdicString getNextEbcdicBytes(int ebcdicByteLength)
          Return the String that corresponds to the next ebcdicByteLength number of EBCDIC bytes of the string iterated on by this class.
 int getRemainingLength()
          Return the EBCDIC byte length of the remainder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EbcdicStringIterator

public EbcdicStringIterator(String unicodeString,
                            int ccsid,
                            boolean isPureDbcs)
Allow the given string to be split up into chunk based on EBCDIC byte lengths

Parameters:
unicodeString - - the string to be split up

EbcdicStringIterator

public EbcdicStringIterator(String unicodeString,
                            int ccsid,
                            boolean isPureDbcs,
                            boolean wantShiftsEmbedded)
Parameters:
unicodeString - - the string we should be iterating over
ccsid - - what the CCSID of the encoding is
isPureDbcs - - whether this is pure DBCS that does not have bracketing shifts
wantShiftsEmbedded - - whether 0x1e and 0x1f bracketing characters should be embedded in DBCS
Method Detail

getNextEbcdicBytes

public IEbcdicString getNextEbcdicBytes(int ebcdicByteLength)
Description copied from interface: IEbcdicStringIterator
Return the String that corresponds to the next ebcdicByteLength number of EBCDIC bytes of the string iterated on by this class. Remove the Unicode characters that correspond the the first ebcdicByteLength number of ebcdic bytes. Return those characters. If the resultant string would be shorter than ebcdicByteLength return it unpadded.

Specified by:
getNextEbcdicBytes in interface IEbcdicStringIterator
Parameters:
ebcdicByteLength - - the desired length
Returns:

getRemainingLength

public int getRemainingLength()
Description copied from interface: IEbcdicStringIterator
Return the EBCDIC byte length of the remainder

Specified by:
getRemainingLength in interface IEbcdicStringIterator
Returns:

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.