|
Rational Developer for Power Systems Software V7.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.etools.iseries.util.StringNL
public class StringNL
String that allows substring and padding operations based on the EBCDIC byte positions rather than the Unicode characters. These would differ in the case of DBCS shift-in, shift-out and extended unicode character (EUC)
Nested Class Summary | |
---|---|
class |
StringNL.DbcsRepairEndingState
Keep track of what happened to the last DBCS character during a truncation operation |
Field Summary | |
---|---|
protected boolean |
_bBidi
|
protected boolean |
_bIgnoringBiDiMarks
|
protected boolean |
_bIsPureDbcs
|
protected boolean |
_bIsVisual
|
protected boolean |
_bMultiByte
|
protected byte[] |
_bytes
|
protected int |
_CCSID
|
protected byte[] |
_state
|
protected String |
_strEncoding
|
protected String |
_string
|
static String |
Copyright
|
static char |
LRM
|
static String |
LRMSTR
|
static char |
RLM
|
static String |
RLMSTR
|
protected byte |
SOURCE_LRM
|
protected byte |
SOURCE_RLM
|
protected static byte |
SOURCE_SI
|
protected static byte |
SOURCE_SO
|
protected static byte |
STATE_DB1
|
protected static byte |
STATE_DB2
|
protected static byte |
STATE_LRM
|
protected static byte |
STATE_RLM
|
protected static byte |
STATE_SB
|
protected static byte |
STATE_SI
|
protected static byte |
STATE_SO
|
protected static char |
TARGET_SI
|
protected static char |
TARGET_SO
|
Constructor Summary | |
---|---|
StringNL(byte[] bytesSource,
String strEncoding,
boolean bMultiByte,
boolean bIsPureDbcs)
Convenience constructor that has a byte array input instead of a String input. |
|
StringNL(String strEncoding,
boolean bMultiByte)
Constructor for empty string. |
|
StringNL(String strSource,
int ccsid)
Main constructor if only know CCSID |
|
StringNL(String strSource,
int ccsid,
boolean isVisual)
Main constructor if only know CCSID |
|
StringNL(String strSource,
int ccsid,
boolean isVisual,
boolean isPureDbcs)
Main constructor if only know CCSID |
|
StringNL(String strSource,
String strEncoding)
Main constructor. |
|
StringNL(String strSource,
String strEncoding,
boolean bMultiByte)
Convenience constructor for strings that are known to be either multibyte or not. |
|
StringNL(String strSource,
String strEncoding,
boolean bMultiByte,
boolean bPureDbcs)
Convenience constructor for strings that are known to be either multibyte or not. |
|
StringNL(String strSource,
String strEncoding,
int ccsid)
Main constructor with encoding and ccsid - checks if this is visual bidi |
Method Summary | |
---|---|
StringNL |
alignLeft(int iByteLengthRequested)
Removes spaces from the left side. |
StringNL |
alignNone(int iByteLengthRequested)
No spaces are removed. |
StringNL |
alignRight(int iByteLengthRequested)
Removes spaces from the right side. |
char |
byteCharAt(int location)
|
int |
byteIndexOf(char c)
Returns the byte index in the string of the specified character |
int |
byteLastIndexOf(char c)
Returns the byte last index in the string of the specified character |
char |
charAt(int location)
Returns the character at the location specified Use byteCharAt to retrieve charactre at a byte locations |
String |
convertFromLogicalToVisual(boolean stripDirectionalMarks)
Converts the string passed to the constructor from logical BIDI format to visual. |
String |
convertFromVisualToLogical(boolean ensureRoundTrip)
Converts the string passed to the constructor from visual BIDI format to logical. |
protected void |
createStateByteArray()
|
protected byte[] |
createStateByteArray(byte[] bytes,
boolean isPureDbcs)
Creates an array the same length as the byte array. |
StringNL |
delete(int iEndByteIndex)
Deletes the specified number of bytes from this string and returns a unicode version of the string taking into account that shift out and shift in characters occupy one byte position, and DBCS characters occupy two byte positions. |
boolean |
equals(StringNL strnlCompare)
Compares two NL strings for equality. |
int |
getBidiCharIndexOfByte(int iTargetByteIndex)
Return the index of the Unicode character that corresponds to the target EBCDIC byte index |
int |
getByteLength()
Returns the byte length of the string if a multibyte string taking into account whether the encoding is multibyte and the encoding supports shift-out/shift-in. |
byte[] |
getBytes()
Attempts to convert the string to a byte array with the given source encoding. |
byte[] |
getBytes(String source)
Attempts to convert a string to a byte array with the given source encoding. |
String |
getEncoding()
Retuns the encoding previously set. |
String |
getExpanded(boolean bPadDoubleByteCharacters,
boolean bUseSpaces)
Creates a line of DBCS unicode with shift-in / shift-out and optional padding characters. |
String |
getStyleString(String strStyle)
Sets an Lpex line's color style. |
boolean |
hasDBCS()
Returns whether the string has DBCS characters or not. |
int |
indexOfRightToLeftCharacter(int offset)
Find the index of the RTL character after the offset |
boolean |
isFirstDbcsByteAt(int byteIndex)
|
boolean |
isIgnoringBidiMarks()
Check if ignoring bidirectional markers (ie is visual bidi) |
boolean |
isLowerCase()
Returns whether this string is lower case. |
boolean |
isSecondDbcsByteAt(int byteIndex)
|
int |
length()
|
static void |
logString(String string)
|
static void |
main(String[] args)
Unit test application. |
protected byte[] |
repairEnding(byte[] bytes)
Corrects the end of a mixed (single and double byte) string given a byte array. |
protected byte[] |
repairEnding(byte[] bytes,
byte[] states,
StringNL.DbcsRepairEndingState endingRepairState)
Corrects the end of a double byte string given a byte array and a state array. |
StringNL |
substring(int iBeginByteIndex)
Returns a unicode version of the substring starting at the given byte index to the end of the string. |
StringNL |
substring(int iBeginByteIndex,
int iEndByteIndex)
Returns a unicode version of the substring taking into account that shift out and shift in characters occupy one byte position, and DBCS characters occupy two byte positions. |
String |
toString()
Returns the string equivalent of the NL string. |
StringNL |
trim()
Remove spaces from both ends of the line |
StringNL |
truncate(int iByteLengthRequested)
Truncates to requested byte length or less. |
StringNL |
truncate(int iByteLengthRequested,
StringNL.DbcsRepairEndingState endingRepairState)
Truncates to requested byte length or less. |
protected byte[] |
truncateBytes(byte[] bytesSource,
int iByteLengthRequested,
StringNL.DbcsRepairEndingState endingRepairState)
Truncates the end of the byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String Copyright
protected String _string
protected String _strEncoding
protected byte[] _bytes
protected byte[] _state
protected boolean _bMultiByte
protected boolean _bBidi
protected int _CCSID
protected boolean _bIgnoringBiDiMarks
protected boolean _bIsVisual
protected boolean _bIsPureDbcs
protected static final byte SOURCE_SI
protected static final byte SOURCE_SO
protected static final char TARGET_SI
protected static final char TARGET_SO
protected static final byte STATE_SB
protected static final byte STATE_SO
protected static final byte STATE_DB1
protected static final byte STATE_DB2
protected static final byte STATE_SI
protected static final byte STATE_RLM
protected static final byte STATE_LRM
public static final char LRM
public static final char RLM
public static final String LRMSTR
public static final String RLMSTR
protected byte SOURCE_RLM
protected byte SOURCE_LRM
Constructor Detail |
---|
public StringNL(String strEncoding, boolean bMultiByte)
public StringNL(String strSource, int ccsid)
public StringNL(String strSource, int ccsid, boolean isVisual)
strSource
- the stringccsid
- the ccsid for the strinfisVisual
- true if the string is in visual order, false otherwisepublic StringNL(String strSource, int ccsid, boolean isVisual, boolean isPureDbcs)
strSource
- the stringccsid
- the ccsid for the strinfisVisual
- true if the string is in visual order, false otherwiseisPureDbcs
- true if the string should not be bracketed by SI/SOpublic StringNL(String strSource, String strEncoding)
public StringNL(String strSource, String strEncoding, int ccsid)
public StringNL(String strSource, String strEncoding, boolean bMultiByte)
public StringNL(String strSource, String strEncoding, boolean bMultiByte, boolean bPureDbcs)
public StringNL(byte[] bytesSource, String strEncoding, boolean bMultiByte, boolean bIsPureDbcs)
bIsPureDbcs
- - whether the bytesSource represents a Pure DBCS string without shift charactersMethod Detail |
---|
public StringNL alignLeft(int iByteLengthRequested)
public StringNL alignNone(int iByteLengthRequested)
public StringNL alignRight(int iByteLengthRequested)
protected void createStateByteArray()
protected byte[] createStateByteArray(byte[] bytes, boolean isPureDbcs)
public boolean equals(StringNL strnlCompare)
public int getByteLength()
public byte[] getBytes()
public byte[] getBytes(String source)
public String getEncoding()
public String getExpanded(boolean bPadDoubleByteCharacters, boolean bUseSpaces)
public String getStyleString(String strStyle)
public boolean hasDBCS()
public boolean isLowerCase()
public static void main(String[] args)
protected byte[] repairEnding(byte[] bytes)
protected byte[] repairEnding(byte[] bytes, byte[] states, StringNL.DbcsRepairEndingState endingRepairState)
bytesLastChar
- - array to contain the bytes of the last DBCS char if it is split by this truncate operation - if the
array is null, then nothing is donepublic StringNL substring(int iBeginByteIndex)
public StringNL substring(int iBeginByteIndex, int iEndByteIndex)
public String toString()
toString
in class Object
public StringNL trim()
public StringNL truncate(int iByteLengthRequested, StringNL.DbcsRepairEndingState endingRepairState)
iByteLengthRequested
- - the requested length in EBCDIC byteschSplitLastChar
- - if the end needed to be repairedpublic StringNL truncate(int iByteLengthRequested)
public int getBidiCharIndexOfByte(int iTargetByteIndex)
protected byte[] truncateBytes(byte[] bytesSource, int iByteLengthRequested, StringNL.DbcsRepairEndingState endingRepairState)
bytesSource
- - the source array of EBCDIC bytesiByteLengthRequested
- - the number of EBCDIC bytes from the beginning of the source array to put into the target arraybRepairEnding
- - whether to make sure that no DBCS char is split at the end and that shift-in chars are present if necessarybytesLastChar
- - array to contain the bytes of the last DBCS char if it is split by this truncate operation - if the
array is null, then nothing is done
public StringNL delete(int iEndByteIndex)
public String convertFromVisualToLogical(boolean ensureRoundTrip) throws UnsupportedEncodingException
ensureRoundTrip
- true if you want to ensure the round trip
(this means that BIDI directional marks
would be added)
UnsupportedEncodingException
- if CCSID is not specified
in the constructor, then
this exception is thrown.public String convertFromLogicalToVisual(boolean stripDirectionalMarks) throws UnsupportedEncodingException
stripDirectionalMarks
- true if you want to strip any BIDI directional marks.
UnsupportedEncodingException
- if CCSID is not specified
in the constructor, then
this exception is thrown.public static void logString(String string)
public int indexOfRightToLeftCharacter(int offset)
offset
-
public boolean isIgnoringBidiMarks()
public int byteIndexOf(char c)
c
- the character to search
public int byteLastIndexOf(char c)
c
- the character to search
public char charAt(int location)
location
- The location to get the character of
public char byteCharAt(int location)
public int length()
public boolean isSecondDbcsByteAt(int byteIndex)
public boolean isFirstDbcsByteAt(int byteIndex)
|
Rational Developer for Power Systems Software V7.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |