Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.util
Class PaddedStringBuffer

java.lang.Object
  extended by com.ibm.etools.iseries.util.PaddedStringBuffer

public class PaddedStringBuffer
extends Object

This class wrappers a StringBuffer and allows additional functionality such as padding the string with spaces, or replacing instances of a substring with another substring. Creation date: (9/26/00 3:43:25 PM)


Field Summary
static String copyRight
           
 
Constructor Summary
PaddedStringBuffer(int length)
          PaddedStringBuffer constructor for a specified length.
PaddedStringBuffer(String arg1)
          PaddedStringBuffer constructor from another String.
 
Method Summary
 void append(char c)
           
 PaddedStringBuffer append(char c, int count)
          pad the string on the right
 void append(int i)
           
 void append(long l)
           
 void append(Object o)
           
 void append(String s)
           
 void appendBinaryInt(int i)
           
 void concat(String s1, String s2, String s3)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14, String s15)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14, String s15, String s16)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14, String s15, String s16, String s17)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14, String s15, String s16, String s17, String s18)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14, String s15, String s16, String s17, String s18, String s19)
          Insert the method's description here.
 void concat(String s1, String s2, String s3, String s4, String s5, String s6, String s7, String s8, String s9, String s10, String s11, String s12, String s13, String s14, String s15, String s16, String s17, String s18, String s19, String s20)
          Insert the method's description here.
 void deleteCharAt(int index)
          Delete a char at the specified index
 void insert(int index, char newChar)
          Insert a character at the specified index of this string buffer is set to newChar.
 void insert(int index, String newStr)
          Insert a String at the specified index of this string buffer is set to newChar.
 boolean isAllBlank()
          Return true if all the characters are blanks.
static boolean isAllBlank(String string)
          Return true if all the characters are blanks.
 boolean isAllChar(char c)
          Return true if the string is composed entirely of the character specified by the c parameter.
static boolean isAllChar(String str, char c)
          Return true if the string is composed entirely of the character specified by the c parameter.
 boolean isAllDBCSBlank()
          Return true if all the characters are DBCS blanks.
 boolean isAllNumbers()
          Return true if all the characters are numbers.
 boolean isCharDBCS(int i, int ccsid)
          Return true if the i'th character in the string would be converted to a DBCS character in the CCSID specified by the ccsid parameter.
 boolean isEmptyOrBlank()
          Returns true if the String is empty or all blanks.
 int length()
          length of the current string
 PaddedStringBuffer padLeft(char c, int length)
          pad the string on the right until it is the specified length
 void padLeftAndConcat(String str1, int len1, char padChar1, String str2, int len2, char padChar2, String str3, int len3, char padChar3, String sep)
          pad the left side of the string to the specified length, concatenate them and set the value to the current string buffer field
 void padLeftAndConcat(String str1, int len1, String str2, int len2, String str3, int len3, String sep, char padChar)
          pad the left side of the string to the specified length, concatenate them and set the value to the current string buffer field
 void padLeftOrTruncateToLength(int desiredLength, char leftPadChar)
          If the string is too short, pad left side of the string to the desired length, if it is too long, truncate from the left to the desired length
 PaddedStringBuffer padRight(char c, int targetLength)
          pad the string on the right until it is the specified length
 void padRightOrTruncateToLength(int desiredLength, char rightPadChar)
          If the string is too short, pad right side oof the string to the desired length, if it is too long, truncate from the right to the desired length
 void replace(int begin, int end, String replaceString)
           
 void replace(String newString)
          Replace the contents of the entire buffer with the new string
 void replaceAndPad(int start, int end, String newString, char paddingChar)
          Replace instances of oldSubstring in string str with string newSubstring Creation date: (10/25/00 10:34:22 AM)
static void replaceSubstring(StringBuffer strBuffer, String str, String oldSubstring, String newSubstring)
          Replace instances of oldSubstring in string str with string newSubstring Creation date: (10/25/00 10:34:22 AM)
 void replaceSubstring(String oldSubstring, String newSubstring)
          Replace instances of oldSubstring in with string newSubstring Creation date: (10/25/00 10:34:22 AM)
static String replaceSubstring(String str, String oldSubstring, String newSubstring)
          Replace instances of oldSubstring in string str with string newSubstring Creation date: (10/25/00 10:34:22 AM)
 void setCharAt(int index, char newChar)
          The character at the specified index of this string buffer is set to newChar.
 void setValue(String str)
          Assign to this instance the value of the passed String
 void setValue(StringBuffer strBuf)
          Assign to this instance the value of the passed StringBuffer
 String toString()
          Return String.
 StringBuffer toStringBuffer()
          Return StringBuffer.
 void toUpperCase()
           
 void toUpperCaseIgnoreDBCS(int ccsid)
           
 int truncateAllSpacesFromLeft()
          Truncates the SBCS or DBCS spaces from the left of the string.
 void truncateAllSpacesFromRight()
          Truncates the SBCS or DBCS spaces from the right of the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copyRight

public static final String copyRight
Constructor Detail

PaddedStringBuffer

public PaddedStringBuffer(int length)
PaddedStringBuffer constructor for a specified length.

Parameters:
length - int

PaddedStringBuffer

public PaddedStringBuffer(String arg1)
PaddedStringBuffer constructor from another String.

Parameters:
arg1 - java.lang.String
Method Detail

append

public void append(char c)

append

public void append(int i)

append

public void append(long l)

append

public void append(Object o)

append

public void append(String s)

replace

public void replace(int begin,
                    int end,
                    String replaceString)

appendBinaryInt

public void appendBinaryInt(int i)

concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4)
Insert the method's description here. Creation date: (1/16/01 4:16:28 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3)
Insert the method's description here. Creation date: (1/16/01 4:16:28 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5)
Insert the method's description here. Creation date: (1/16/01 4:16:45 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6)
Insert the method's description here. Creation date: (1/16/01 4:17:08 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7)
Insert the method's description here. Creation date: (1/16/01 4:17:18 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14,
                   String s15)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14,
                   String s15,
                   String s16)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14,
                   String s15,
                   String s16,
                   String s17)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14,
                   String s15,
                   String s16,
                   String s17,
                   String s18)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14,
                   String s15,
                   String s16,
                   String s17,
                   String s18,
                   String s19)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


concat

public void concat(String s1,
                   String s2,
                   String s3,
                   String s4,
                   String s5,
                   String s6,
                   String s7,
                   String s8,
                   String s9,
                   String s10,
                   String s11,
                   String s12,
                   String s13,
                   String s14,
                   String s15,
                   String s16,
                   String s17,
                   String s18,
                   String s19,
                   String s20)
Insert the method's description here. Creation date: (1/16/01 4:17:27 PM)


isAllBlank

public boolean isAllBlank()
Return true if all the characters are blanks. Returns false if the string buffer is zero length.


isAllBlank

public static boolean isAllBlank(String string)
Return true if all the characters are blanks. Return true if the string is empty or null


isAllChar

public boolean isAllChar(char c)
Return true if the string is composed entirely of the character specified by the c parameter. Empty string returns false.


isAllChar

public static boolean isAllChar(String str,
                                char c)
Return true if the string is composed entirely of the character specified by the c parameter. Empty string returns false.

Throws:
NullPointerException - if str is null.

isAllDBCSBlank

public boolean isAllDBCSBlank()
Return true if all the characters are DBCS blanks.

Returns:
boolean

isCharDBCS

public boolean isCharDBCS(int i,
                          int ccsid)
Return true if the i'th character in the string would be converted to a DBCS character in the CCSID specified by the ccsid parameter. Return false otherwise. Throws IllegalArgumentException if the integer i does not fall in the range of the strings character array. Creation date: (2001/11/5 ?U?? 01:26:03)

Parameters:
i - int
ccsid - int
Returns:
boolean

isEmptyOrBlank

public boolean isEmptyOrBlank()
Returns true if the String is empty or all blanks. Creation date: (8/10/2001 10:51:24 AM)

Returns:
boolean

padLeft

public PaddedStringBuffer padLeft(char c,
                                  int length)
pad the string on the right until it is the specified length


padRightOrTruncateToLength

public void padRightOrTruncateToLength(int desiredLength,
                                       char rightPadChar)
If the string is too short, pad right side oof the string to the desired length, if it is too long, truncate from the right to the desired length


padLeftOrTruncateToLength

public void padLeftOrTruncateToLength(int desiredLength,
                                      char leftPadChar)
If the string is too short, pad left side of the string to the desired length, if it is too long, truncate from the left to the desired length


padRight

public PaddedStringBuffer padRight(char c,
                                   int targetLength)
pad the string on the right until it is the specified length


append

public PaddedStringBuffer append(char c,
                                 int count)
pad the string on the right

Parameters:
c - - the character to pad with
count - - the number of times to append that character

replaceSubstring

public void replaceSubstring(String oldSubstring,
                             String newSubstring)
Replace instances of oldSubstring in with string newSubstring Creation date: (10/25/00 10:34:22 AM)

Parameters:
c - char
repl - java.lang.String

replaceSubstring

public static final String replaceSubstring(String str,
                                            String oldSubstring,
                                            String newSubstring)
Replace instances of oldSubstring in string str with string newSubstring Creation date: (10/25/00 10:34:22 AM)

Parameters:
in - java.lang.String
c - char
repl - java.lang.String
Returns:
java.lang.String

replaceSubstring

public static final void replaceSubstring(StringBuffer strBuffer,
                                          String str,
                                          String oldSubstring,
                                          String newSubstring)
Replace instances of oldSubstring in string str with string newSubstring Creation date: (10/25/00 10:34:22 AM)

Parameters:
in - java.lang.String
c - char
repl - java.lang.String

replaceAndPad

public void replaceAndPad(int start,
                          int end,
                          String newString,
                          char paddingChar)
Replace instances of oldSubstring in string str with string newSubstring Creation date: (10/25/00 10:34:22 AM)

Parameters:
in - java.lang.String
c - char
repl - java.lang.String

replace

public void replace(String newString)
Replace the contents of the entire buffer with the new string

Parameters:
newString -

setValue

public void setValue(String str)
Assign to this instance the value of the passed String

Parameters:
strBuf - java.lang.StringBuffer

setValue

public void setValue(StringBuffer strBuf)
Assign to this instance the value of the passed StringBuffer

Parameters:
strBuf - java.lang.StringBuffer

toString

public String toString()
Return String.

Overrides:
toString in class Object
Returns:
java.lang.String

toStringBuffer

public StringBuffer toStringBuffer()
Return StringBuffer.

Returns:
java.lang.StringBuffer

truncateAllSpacesFromRight

public void truncateAllSpacesFromRight()
Truncates the SBCS or DBCS spaces from the right of the string. Creation date: (2001/11/5 ?U?? 01:04:19)


truncateAllSpacesFromLeft

public int truncateAllSpacesFromLeft()
Truncates the SBCS or DBCS spaces from the left of the string.

Returns:
the number of spaces truncated

toUpperCaseIgnoreDBCS

public void toUpperCaseIgnoreDBCS(int ccsid)

toUpperCase

public void toUpperCase()

isAllNumbers

public boolean isAllNumbers()
Return true if all the characters are numbers.

Returns:
boolean

padLeftAndConcat

public void padLeftAndConcat(String str1,
                             int len1,
                             char padChar1,
                             String str2,
                             int len2,
                             char padChar2,
                             String str3,
                             int len3,
                             char padChar3,
                             String sep)
pad the left side of the string to the specified length, concatenate them and set the value to the current string buffer field


padLeftAndConcat

public void padLeftAndConcat(String str1,
                             int len1,
                             String str2,
                             int len2,
                             String str3,
                             int len3,
                             String sep,
                             char padChar)
pad the left side of the string to the specified length, concatenate them and set the value to the current string buffer field


deleteCharAt

public void deleteCharAt(int index)
Delete a char at the specified index


setCharAt

public void setCharAt(int index,
                      char newChar)
The character at the specified index of this string buffer is set to newChar.


insert

public void insert(int index,
                   char newChar)
Insert a character at the specified index of this string buffer is set to newChar.


insert

public void insert(int index,
                   String newStr)
Insert a String at the specified index of this string buffer is set to newChar.


length

public int length()
length of the current string


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.