You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2007/03/03 04:43:26 UTC
svn commit: r514063 -
/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
Author: dims
Date: Fri Mar 2 19:43:26 2007
New Revision: 514063
URL: http://svn.apache.org/viewvc?view=rev&rev=514063
Log:
Don't use com.sun
Modified:
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?view=diff&rev=514063&r1=514062&r2=514063
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java Fri Mar 2 19:43:26 2007
@@ -28,8 +28,8 @@
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
-
-import com.sun.mail.util.BASE64EncoderStream;
+import org.apache.axiom.attachments.utils.IOUtils;
+import org.apache.axiom.om.util.Base64;
public class AttachmentTest extends TestCase {
@@ -318,15 +318,10 @@
//Create InputStream from DataHandler's InputStream
InputStream is = dh.getInputStream();
+ byte buf[] = IOUtils.getStreamAsByteArray(is);
//Setting Content via InputStream for image/jpeg mime type
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- OutputStream ret = new BASE64EncoderStream(bos);
- int count;
- byte buf[] = new byte[8192];
- while ((count = is.read(buf, 0, 8192)) != -1) {
- ret.write(buf, 0, count);
- }
- ret.flush();
+ Base64.encode(buf, 0, buf.length, bos);
buf = bos.toByteArray();
InputStream stream = new ByteArrayInputStream(buf);
ap.setBase64Content(stream,"image/jpeg");
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org