james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r735881 - in /james/mime4j/trunk/src/main/java/org/apache/james/mime4j: codec/DecoderUtil.java message/Header.java message/MessageBuilder.java parser/MimeEntityConfig.java util/MimeUtil.java
Date Tue, 20 Jan 2009 00:00:56 GMT
Author: mwiederkehr
Date: Mon Jan 19 16:00:56 2009
New Revision: 735881

URL: http://svn.apache.org/viewvc?rev=735881&view=rev
Log:
use StringBuilder instead of CharArrayBuffer (the advantage of CharArrayBuffer over StringBuffer
is that it is not synchronized; with StringBuilder this advantage is gone)

Modified:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntityConfig.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java?rev=735881&r1=735880&r2=735881&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java Mon Jan
19 16:00:56 2009
@@ -26,7 +26,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.james.mime4j.util.CharArrayBuffer;
 import org.apache.james.mime4j.util.CharsetUtil;
 
 /**
@@ -125,7 +124,7 @@
         /*
          * Replace _ with =20
          */
-        CharArrayBuffer sb = new CharArrayBuffer(128);
+        StringBuilder sb = new StringBuilder(128);
         for (int i = 0; i < encodedWord.length(); i++) {
             char c = encodedWord.charAt(i);
             if (c == '_') {

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java?rev=735881&r1=735880&r2=735881&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java Mon Jan 19
16:00:56 2009
@@ -38,7 +38,6 @@
 import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.parser.AbstractContentHandler;
 import org.apache.james.mime4j.parser.MimeStreamParser;
-import org.apache.james.mime4j.util.CharArrayBuffer;
 import org.apache.james.mime4j.util.CharsetUtil;
 
 
@@ -228,7 +227,7 @@
      */
     @Override
     public String toString() {
-        CharArrayBuffer str = new CharArrayBuffer(128);
+        StringBuilder str = new StringBuilder(128);
         for (Field field : fields) {
             str.append(field.toString());
             str.append("\r\n");

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java?rev=735881&r1=735880&r2=735881&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java Mon
Jan 19 16:00:56 2009
@@ -30,7 +30,6 @@
 import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.parser.ContentHandler;
 import org.apache.james.mime4j.storage.StorageProvider;
-import org.apache.james.mime4j.util.CharArrayBuffer;
 import org.apache.james.mime4j.util.MimeUtil;
 
 public class MessageBuilder implements ContentHandler {
@@ -177,7 +176,7 @@
      */
     public void epilogue(InputStream is) throws MimeException, IOException {
         expect(Multipart.class);
-        CharArrayBuffer sb = new CharArrayBuffer(128);
+        StringBuilder sb = new StringBuilder(128);
         int b;
         while ((b = is.read()) != -1) {
             sb.append((char) b);
@@ -190,7 +189,7 @@
      */
     public void preamble(InputStream is) throws MimeException, IOException {
         expect(Multipart.class);
-        CharArrayBuffer sb = new CharArrayBuffer(128);
+        StringBuilder sb = new StringBuilder(128);
         int b;
         while ((b = is.read()) != -1) {
             sb.append((char) b);

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntityConfig.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntityConfig.java?rev=735881&r1=735880&r2=735881&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntityConfig.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntityConfig.java
Mon Jan 19 16:00:56 2009
@@ -20,7 +20,6 @@
 package org.apache.james.mime4j.parser;
 
 import org.apache.james.mime4j.MimeException;
-import org.apache.james.mime4j.util.CharArrayBuffer;
 
 /**
  * MIME entity configuration
@@ -150,7 +149,7 @@
     
     @Override
     public String toString() {
-        CharArrayBuffer buffer = new CharArrayBuffer(128);
+        StringBuilder buffer = new StringBuilder(128);
         buffer.append("[max body descriptor: ");
         buffer.append(Boolean.toString(this.maximalBodyDescriptor));
         buffer.append("][strict parsing: ");

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java?rev=735881&r1=735880&r2=735881&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java Mon Jan 19
16:00:56 2009
@@ -172,7 +172,7 @@
         /*
          * Unfold Content-Type value
          */
-        CharArrayBuffer sb = new CharArrayBuffer(128);
+        StringBuilder sb = new StringBuilder(128);
         for (int i = 0; i < pValue.length(); i++) {
             char c = pValue.charAt(i);
             if (c == '\r' || c == '\n') {
@@ -198,8 +198,8 @@
         result.put("", main);
         if (rest != null) {
             char[] chars = rest.toCharArray();
-            CharArrayBuffer paramName = new CharArrayBuffer(64);
-            CharArrayBuffer paramValue = new CharArrayBuffer(64);
+            StringBuilder paramName = new StringBuilder(64);
+            StringBuilder paramValue = new StringBuilder(64);
 
             final byte READY_FOR_NAME = 0;
             final byte IN_NAME = 1;
@@ -225,8 +225,8 @@
                             break;
                         }
 
-                        paramName = new CharArrayBuffer(64);
-                        paramValue = new CharArrayBuffer(64);
+                        paramName.setLength(0);
+                        paramValue.setLength(0);
 
                         state = IN_NAME;
                         // fall-through



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message