* Move almost all uses of StringBuffer to StringBuilder,
for efficiency (thanks Arsene for the suggestion)
This commit is contained in:
@ -142,7 +142,7 @@ public class Mail {
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
public static void appendRecipients( StringBuffer buf, ArrayList recipients, String prefix )
|
||||
public static void appendRecipients( StringBuilder buf, ArrayList recipients, String prefix )
|
||||
{
|
||||
for( Iterator it = recipients.iterator(); it.hasNext(); ) {
|
||||
buf.append( prefix );
|
||||
|
@ -444,7 +444,7 @@ public class WebMail extends HttpServlet
|
||||
boolean showBody = false;
|
||||
boolean prepareAttachment = false;
|
||||
String reason = "";
|
||||
StringBuffer body = null;
|
||||
StringBuilder body = null;
|
||||
|
||||
String ident = quoteHTML(
|
||||
( mailPart.description != null ? mailPart.description + ", " : "" ) +
|
||||
@ -485,7 +485,7 @@ public class WebMail extends HttpServlet
|
||||
try {
|
||||
ReadBuffer decoded = e.decode( mailPart.buffer.content, mailPart.beginBody, mailPart.end - mailPart.beginBody );
|
||||
BufferedReader reader = new BufferedReader( new InputStreamReader( new ByteArrayInputStream( decoded.content, decoded.offset, decoded.length ), charset ) );
|
||||
body = new StringBuffer();
|
||||
body = new StringBuilder();
|
||||
String line;
|
||||
while( ( line = reader.readLine() ) != null ) {
|
||||
body.append( quoteHTML( line ) );
|
||||
@ -782,7 +782,7 @@ public class WebMail extends HttpServlet
|
||||
/*
|
||||
* extract additional recipients
|
||||
*/
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String pad = "";
|
||||
if( mail.to != null ) {
|
||||
for( int i = 0; i < mail.to.length; i++ ) {
|
||||
@ -1429,7 +1429,7 @@ public class WebMail extends HttpServlet
|
||||
}
|
||||
|
||||
if( ok ) {
|
||||
StringBuffer body = new StringBuffer();
|
||||
StringBuilder body = new StringBuilder();
|
||||
body.append( "From: " + from + "\r\n" );
|
||||
Mail.appendRecipients( body, toList, "To: " );
|
||||
Mail.appendRecipients( body, ccList, "To: " );
|
||||
|
@ -70,7 +70,7 @@ public class Base64 implements Encoding {
|
||||
*/
|
||||
private String encode( InputStream in ) throws IOException, EncodingException
|
||||
{
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
StringBuilder strBuf = new StringBuilder();
|
||||
|
||||
int buf[] = new int[3];
|
||||
int out[] = new int[4];
|
||||
|
@ -55,7 +55,7 @@ public class HeaderLine implements Encoding {
|
||||
private static final int BUFSIZE = 2;
|
||||
private String encode(InputStream in) throws IOException
|
||||
{
|
||||
StringBuffer out = new StringBuffer();
|
||||
StringBuilder out = new StringBuilder();
|
||||
int l = 0, buffered = 0, tmp[] = new int[BUFSIZE];
|
||||
boolean quoting = false;
|
||||
boolean quote = false;
|
||||
|
@ -69,7 +69,7 @@ public class QuotedPrintable implements Encoding {
|
||||
*/
|
||||
private static int BUFSIZE = 2;
|
||||
private String encode( InputStream in ) throws EncodingException, IOException {
|
||||
StringBuffer out = new StringBuffer();
|
||||
StringBuilder out = new StringBuilder();
|
||||
int l = 0;
|
||||
int read = 0, buffered = 0, tmp[] = new int[BUFSIZE];
|
||||
while( true ) {
|
||||
|
Reference in New Issue
Block a user