james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r572821 - in /james/mime4j/trunk/src/main/java/org/apache/james/mime4j: message/Message.java util/MimeUtil.java
Date Tue, 04 Sep 2007 22:04:11 GMT
Author: bago
Date: Tue Sep  4 15:04:10 2007
New Revision: 572821

URL: http://svn.apache.org/viewvc?rev=572821&view=rev
Log:
Avoid MimeUtil instantiability, 
Use ContentTransferEncodingField constants "base64" and "quoted-printable" when possible.

Modified:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.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/message/Message.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java?rev=572821&r1=572820&r2=572821&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java Tue Sep
 4 15:04:10 2007
@@ -30,6 +30,7 @@
 import org.apache.james.mime4j.MimeStreamParser;
 import org.apache.james.mime4j.decoder.Base64InputStream;
 import org.apache.james.mime4j.decoder.QuotedPrintableInputStream;
+import org.apache.james.mime4j.field.ContentTransferEncodingField;
 import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.UnstructuredField;
 
@@ -183,9 +184,9 @@
             expect(Entity.class);
             
             String enc = bd.getTransferEncoding();
-            if ("base64".equals(enc)) {
+            if (ContentTransferEncodingField.ENC_BASE64.equals(enc)) {
                 is = new Base64InputStream(is);
-            } else if ("quoted-printable".equals(enc)) {
+            } else if (ContentTransferEncodingField.ENC_QUOTED_PRINTABLE.equals(enc)) {
                 is = new QuotedPrintableInputStream(is);
             }
             

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=572821&r1=572820&r2=572821&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 Tue Sep  4
15:04:10 2007
@@ -5,15 +5,21 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.james.mime4j.field.ContentTransferEncodingField;
 
 
 /**
  * A utility class, which provides some MIME related application logic,
  * depending on abstract objects like the {@link BodyDescriptor}.
  */
-public class MimeUtil {
+public final class MimeUtil {
     private static final Log log = LogFactory.getLog(MimeUtil.class);
 
+    private MimeUtil() {
+        // this is an utility class to be used statically.
+        // this constructor protect from instantiation.
+    }
+    
     /**
      * Returns, whether the given two MIME types are identical.
      */
@@ -39,14 +45,14 @@
      * Returns, whether the given transfer-encoding is "base64".
      */
     public static boolean isBase64Encoding(String pTransferEncoding) {
-        return "base64".equalsIgnoreCase(pTransferEncoding);
+        return ContentTransferEncodingField.ENC_BASE64.equalsIgnoreCase(pTransferEncoding);
     }
 
     /**
      * Returns, whether the given transfer-encoding is "quoted-printable".
      */
     public static boolean isQuotedPrintableEncoded(String pTransferEncoding) {
-        return "quoted-printable".equals(pTransferEncoding);
+        return ContentTransferEncodingField.ENC_QUOTED_PRINTABLE.equals(pTransferEncoding);
     }
 
     /**



---------------------------------------------------------------------
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