Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.util
Class WrappedEbcdicStringIterator

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

public class WrappedEbcdicStringIterator
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.


Nested Class Summary
static class WrappedEbcdicStringIterator.WrappedEbcdicString
          Instance holding a string that corresponds to EBCDIC DBCS that is being truncated, one segment at a time.
static class WrappedEbcdicStringIterator.WrappedEbcdicStringResult
           
 
Constructor Summary
WrappedEbcdicStringIterator(String unicodeString, int ccsid, boolean isPureDbcs)
          Allow the given string to be split up into chunk based on EBCDIC byte lengths
 
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

WrappedEbcdicStringIterator

public WrappedEbcdicStringIterator(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
Method Detail

getNextEbcdicBytes

public 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. Remove the Unicode characters that correspond the the first ebcdicByteLength number of ebcdic bytes. Return those characters.

Specified by:
getNextEbcdicBytes in interface IEbcdicStringIterator
Parameters:
ebcdicByteLength - - the desired length, in EBCDIC bytes, of the resultant string.
Returns:

getRemainingLength

public int getRemainingLength()
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.