You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by mw...@apache.org on 2008/12/15 14:59:08 UTC

svn commit: r726697 - in /james/mime4j/trunk/src: main/java/org/apache/james/mime4j/decoder/Base64Encoder.java main/java/org/apache/james/mime4j/decoder/CodecUtil.java test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java

Author: mwiederkehr
Date: Mon Dec 15 05:59:08 2008
New Revision: 726697

URL: http://svn.apache.org/viewvc?rev=726697&view=rev
Log:
Removed Base64Encoder and rewrote CodecUtil.encodeBase64() to use Base64OutputStream instead. Resolves MIME4J-66 and MIME4J-67.

Removed:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64Encoder.java
Modified:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/CodecUtil.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/CodecUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/CodecUtil.java?rev=726697&r1=726696&r2=726697&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/CodecUtil.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/CodecUtil.java Mon Dec 15 05:59:08 2008
@@ -72,12 +72,19 @@
         encoder.encode(in, out);
     }
     
+    /**
+     * Encodes the given stream using base64.
+     *
+     * @param in not null
+     * @param out not null
+     * @throws IOException if an I/O error occurs
+     */
     public static void encodeBase64(final InputStream in, final OutputStream out) throws IOException {
-        final Base64Encoder encoder = new Base64Encoder(DEFAULT_ENCODING_BUFFER_SIZE);
-        encoder.encode(in, out);
+        Base64OutputStream b64Out = new Base64OutputStream(out);
+        copy(in, b64Out);
+        b64Out.close();
     }
     
-    
     /**
      * Wraps the given stream in a Quoted-Printable encoder.
      * @param out not null

Modified: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java?rev=726697&r1=726696&r2=726697&view=diff
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java (original)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java Mon Dec 15 05:59:08 2008
@@ -98,7 +98,6 @@
     /**
      * This test is a proof for MIME4J-67
      */
-    /* Currently commented because we don't want failing tests.
     public void testBase64Encoder() throws Exception {
         StringBuilder sb = new StringBuilder(2048);
         for (int i = 0; i < 128; i++) {
@@ -119,7 +118,6 @@
         String output = new String(outRoundtrip.toByteArray());
         return output;
     } 
-    */
     
     /* performance test, not a unit test */
     /*



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