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/29 20:23:48 UTC

svn commit: r729976 - /james/mime4j/trunk/benchmarks/src/org/apache/james/mime4j/LongMultipartReadBench.java

Author: mwiederkehr
Date: Mon Dec 29 11:23:47 2008
New Revision: 729976

URL: http://svn.apache.org/viewvc?rev=729976&view=rev
Log:
added ASF header; use of CodecUtil.copy(); changed unit to seconds

Modified:
    james/mime4j/trunk/benchmarks/src/org/apache/james/mime4j/LongMultipartReadBench.java

Modified: james/mime4j/trunk/benchmarks/src/org/apache/james/mime4j/LongMultipartReadBench.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/benchmarks/src/org/apache/james/mime4j/LongMultipartReadBench.java?rev=729976&r1=729975&r2=729976&view=diff
==============================================================================
--- james/mime4j/trunk/benchmarks/src/org/apache/james/mime4j/LongMultipartReadBench.java (original)
+++ james/mime4j/trunk/benchmarks/src/org/apache/james/mime4j/LongMultipartReadBench.java Mon Dec 29 11:23:47 2008
@@ -1,9 +1,29 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mime4j;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 
+import org.apache.james.mime4j.decoder.CodecUtil;
 import org.apache.james.mime4j.parser.MimeTokenStream;
 
 public class LongMultipartReadBench {
@@ -19,11 +39,7 @@
             return;
         }
         try {
-            int l;
-            byte[] tmp = new byte[2048];
-            while ((l = instream.read(tmp)) != -1) {
-                outstream.write(tmp, 0, l);
-            }
+            CodecUtil.copy(instream, outstream);
         } finally {
             instream.close();
         }
@@ -51,7 +67,7 @@
         }
         long finish = System.currentTimeMillis();
         System.out.println("Execution time: " 
-                + ((double)(finish - start) / 1000) + " ms" );
+                + ((double)(finish - start) / 1000) + " s" );
     }
     
 }



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