summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2008-05-06 22:20:34 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2008-05-06 22:20:34 +0000
commit706d1fd91ee86211b6c5a3c7eddf687626021a43 (patch)
treeea8256c522e8fe4e7f84bc387072533775358cf6 /java
parent033159fe529d8a6f0a67e8d15c95a65577544a5d (diff)
downloadclasspath-706d1fd91ee86211b6c5a3c7eddf687626021a43.tar.gz
2008-05-06 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/21869 * java/text/AttributedString.java, * java/text/ChoiceFormat.java, * java/text/CollationElementIterator.java, * java/text/Collator.java, * java/text/DecimalFormat.java, * java/text/MessageFormat.java, * java/text/RuleBasedCollator.java: Swap use of StringBuffer for CPStringBuilder.
Diffstat (limited to 'java')
-rw-r--r--java/text/AttributedString.java4
-rw-r--r--java/text/ChoiceFormat.java8
-rw-r--r--java/text/CollationElementIterator.java4
-rw-r--r--java/text/Collator.java2
-rw-r--r--java/text/DecimalFormat.java18
-rw-r--r--java/text/MessageFormat.java8
-rw-r--r--java/text/RuleBasedCollator.java2
7 files changed, 28 insertions, 18 deletions
diff --git a/java/text/AttributedString.java b/java/text/AttributedString.java
index 6785bd3c5..cb338bfe8 100644
--- a/java/text/AttributedString.java
+++ b/java/text/AttributedString.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.text;
+import gnu.java.lang.CPStringBuilder;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -182,7 +184,7 @@ public class AttributedString
if ((begin < 0) || (end < begin) || end > aci.getEndIndex())
throw new IllegalArgumentException("Bad index values");
- StringBuffer sb = new StringBuffer("");
+ CPStringBuilder sb = new CPStringBuilder("");
// Get the valid attribute list
Set allAttribs = aci.getAllAttributeKeys();
diff --git a/java/text/ChoiceFormat.java b/java/text/ChoiceFormat.java
index 629701c17..4d29bf8d8 100644
--- a/java/text/ChoiceFormat.java
+++ b/java/text/ChoiceFormat.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package java.text;
+import gnu.java.lang.CPStringBuilder;
+
import java.util.Vector;
/**
@@ -98,7 +100,7 @@ public class ChoiceFormat extends NumberFormat
int index = 0, max = newPattern.length();
Vector stringVec = new Vector ();
Vector limitVec = new Vector ();
- StringBuffer buf = new StringBuffer ();
+ final CPStringBuilder buf = new CPStringBuilder ();
while (true)
{
@@ -442,7 +444,7 @@ public class ChoiceFormat extends NumberFormat
this.choiceLimits = (double[]) choiceLimits.clone();
}
- private void quoteString (StringBuffer dest, String text)
+ private void quoteString (CPStringBuilder dest, String text)
{
int max = text.length();
for (int i = 0; i < max; ++i)
@@ -473,7 +475,7 @@ public class ChoiceFormat extends NumberFormat
*/
public String toPattern ()
{
- StringBuffer result = new StringBuffer ();
+ CPStringBuilder result = new CPStringBuilder ();
for (int i = 0; i < choiceLimits.length; ++i)
{
result.append(choiceLimits[i]);
diff --git a/java/text/CollationElementIterator.java b/java/text/CollationElementIterator.java
index 08c5cb563..f6e0022aa 100644
--- a/java/text/CollationElementIterator.java
+++ b/java/text/CollationElementIterator.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.text;
+import gnu.java.lang.CPStringBuilder;
+
import java.util.ArrayList;
/* Written using "Java Class Libraries", 2nd edition, plus online
@@ -416,7 +418,7 @@ public final class CollationElementIterator
*/
public void setText(CharacterIterator source)
{
- StringBuffer expand = new StringBuffer();
+ CPStringBuilder expand = new CPStringBuilder();
// For now assume we read from the beginning of the string.
for (char c = source.first();
diff --git a/java/text/Collator.java b/java/text/Collator.java
index 16ee6b124..d6cb5ac0e 100644
--- a/java/text/Collator.java
+++ b/java/text/Collator.java
@@ -406,10 +406,12 @@ public abstract class Collator implements Comparator<Object>, Cloneable
// Decompose a single character and append results to the buffer.
// FIXME: for libgcj this is a native method which handles
// decomposition. For Classpath, for now, it does nothing.
+ /*
final void decomposeCharacter (char c, StringBuffer buf)
{
buf.append (c);
}
+ */
/**
* This is the current collation decomposition setting.
diff --git a/java/text/DecimalFormat.java b/java/text/DecimalFormat.java
index 11b6ed5c7..6dc6aa994 100644
--- a/java/text/DecimalFormat.java
+++ b/java/text/DecimalFormat.java
@@ -43,6 +43,8 @@ exception statement from your version. */
package java.text;
+import gnu.java.lang.CPStringBuilder;
+
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -588,7 +590,7 @@ public class DecimalFormat extends NumberFormat
return Double.valueOf(Double.NaN);
// this will be our final number
- StringBuffer number = new StringBuffer();
+ CPStringBuilder number = new CPStringBuilder();
// special character
char minus = symbols.getMinusSign();
@@ -1003,7 +1005,7 @@ public class DecimalFormat extends NumberFormat
*/
private String patternChars (DecimalFormatSymbols syms)
{
- StringBuffer buf = new StringBuffer ();
+ CPStringBuilder buf = new CPStringBuilder ();
buf.append(syms.getDecimalSeparator());
buf.append(syms.getDigit());
@@ -1028,9 +1030,9 @@ public class DecimalFormat extends NumberFormat
* @param patChars
* @return A StringBuffer with special characters quoted.
*/
- private StringBuffer quoteFix(String text, String patChars)
+ private CPStringBuilder quoteFix(String text, String patChars)
{
- StringBuffer buf = new StringBuffer();
+ CPStringBuilder buf = new CPStringBuilder();
int len = text.length();
char ch;
@@ -1058,7 +1060,7 @@ public class DecimalFormat extends NumberFormat
*/
private String computePattern(DecimalFormatSymbols symbols)
{
- StringBuffer mainPattern = new StringBuffer();
+ StringBuilder mainPattern = new StringBuilder();
// We have to at least emit a zero for the minimum number of
// digits. Past that we need hash marks up to the grouping
@@ -1225,7 +1227,7 @@ public class DecimalFormat extends NumberFormat
private int scanFix(String pattern, DecimalFormatSymbols sourceSymbols,
int start, boolean prefix)
{
- StringBuffer buffer = new StringBuffer();
+ CPStringBuilder buffer = new CPStringBuilder();
// the number portion is always delimited by one of those
// characters
@@ -1599,7 +1601,7 @@ public class DecimalFormat extends NumberFormat
DecimalFormatSymbols sourceSymbols,
int start)
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
// the number portion is always delimited by one of those
// characters
@@ -2180,7 +2182,7 @@ public class DecimalFormat extends NumberFormat
else
{
char zero = symbols.getZeroDigit();
- StringBuffer _result = new StringBuffer(src);
+ CPStringBuilder _result = new CPStringBuilder(src);
for (int i = len; i < minimumDigits; i++)
{
_result.append(zero);
diff --git a/java/text/MessageFormat.java b/java/text/MessageFormat.java
index 5a595f576..c5579bff1 100644
--- a/java/text/MessageFormat.java
+++ b/java/text/MessageFormat.java
@@ -194,7 +194,7 @@ public class MessageFormat extends Format
// Helper that returns the text up to the next format opener. The
// text is put into BUFFER. Returns index of character after end of
// string. Throws IllegalArgumentException on error.
- private static int scanString(String pat, int index, StringBuffer buffer)
+ private static int scanString(String pat, int index, StringBuilder buffer)
{
int max = pat.length();
buffer.setLength(0);
@@ -234,7 +234,7 @@ public class MessageFormat extends Format
// This helper retrieves a single part of a format element. Returns
// the index of the terminating character.
private static int scanFormatElement(String pat, int index,
- StringBuffer buffer, char term)
+ StringBuilder buffer, char term)
{
int max = pat.length();
buffer.setLength(0);
@@ -281,7 +281,7 @@ public class MessageFormat extends Format
// This is used to parse a format element and whatever non-format
// text might trail it.
- private static int scanFormat(String pat, int index, StringBuffer buffer,
+ private static int scanFormat(String pat, int index, StringBuilder buffer,
Vector elts, Locale locale)
{
MessageFormatElement mfe = new MessageFormatElement ();
@@ -342,7 +342,7 @@ public class MessageFormat extends Format
{
pattern = newPattern;
- StringBuffer tempBuffer = new StringBuffer ();
+ StringBuilder tempBuffer = new StringBuilder ();
int index = scanString (newPattern, 0, tempBuffer);
leader = tempBuffer.toString();
diff --git a/java/text/RuleBasedCollator.java b/java/text/RuleBasedCollator.java
index 7ec18dcc9..fdd1446cc 100644
--- a/java/text/RuleBasedCollator.java
+++ b/java/text/RuleBasedCollator.java
@@ -404,7 +404,7 @@ public class RuleBasedCollator extends Collator
{
boolean ignoreChars = (base_offset == 0);
int operator = -1;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean doubleQuote = false;
boolean eatingChars = false;
boolean nextIsModifier = false;