Commit 0751edb3 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #328 from sco0ter/stringbuffer

Replace StringBuffer with StringBuilder (for performance).
parents 23008828 5094bbe3
...@@ -155,7 +155,7 @@ public class FlashCrossDomainHandler extends BasicModule { ...@@ -155,7 +155,7 @@ public class FlashCrossDomainHandler extends BasicModule {
* @return the string read from the reader. * @return the string read from the reader.
*/ */
protected String read(BufferedReader in) { protected String read(BufferedReader in) {
StringBuffer buffer = new StringBuffer(); StringBuilder buffer = new StringBuilder();
int codePoint; int codePoint;
boolean stopReading = false; boolean stopReading = false;
int invalidCodePoints = 0; int invalidCodePoints = 0;
......
...@@ -86,7 +86,7 @@ public class URLUTF8Encoder ...@@ -86,7 +86,7 @@ public class URLUTF8Encoder
*/ */
public static String encode(String s) public static String encode(String s)
{ {
StringBuffer sbuf = new StringBuffer(); StringBuilder sbuf = new StringBuilder();
int len = s.length(); int len = s.length();
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
int ch = s.charAt(i); int ch = s.charAt(i);
......
...@@ -502,7 +502,7 @@ public class FastDateFormat { ...@@ -502,7 +502,7 @@ public class FastDateFormat {
} }
private static String parseToken(String pattern, int[] indexRef) { private static String parseToken(String pattern, int[] indexRef) {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
int i = indexRef[0]; int i = indexRef[0];
int length = pattern.length(); int length = pattern.length();
......
...@@ -300,7 +300,7 @@ public class LocaleUtils { ...@@ -300,7 +300,7 @@ public class LocaleUtils {
*/ */
public static String getTimeZoneName(String zoneID, Locale locale) { public static String getTimeZoneName(String zoneID, Locale locale) {
TimeZone zone = TimeZone.getTimeZone(zoneID); TimeZone zone = TimeZone.getTimeZone(zoneID);
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
// Add in the GMT part to the name. First, figure out the offset. // Add in the GMT part to the name. First, figure out the offset.
int offset = zone.getRawOffset(); int offset = zone.getRawOffset();
if (zone.inDaylightTime(new Date()) && zone.useDaylightTime()) { if (zone.inDaylightTime(new Date()) && zone.useDaylightTime()) {
......
...@@ -1051,13 +1051,13 @@ public class StringUtils { ...@@ -1051,13 +1051,13 @@ public class StringUtils {
diff = diff % MS_IN_A_SECOND; diff = diff % MS_IN_A_SECOND;
//long numMilliseconds = diff; //long numMilliseconds = diff;
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
if (numHours > 0) { if (numHours > 0) {
buf.append(numHours + " " + HOURS + ", "); buf.append(numHours).append(' ').append(HOURS).append(", ");
} }
if (numMinutes > 0) { if (numMinutes > 0) {
buf.append(numMinutes + " " + MINUTES); buf.append(numMinutes).append(' ').append(MINUTES);
} }
//buf.append(numSeconds + " " + SECONDS); //buf.append(numSeconds + " " + SECONDS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment