cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r608233 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
Date Wed, 02 Jan 2008 21:12:40 GMT
Author: dkulp
Date: Wed Jan  2 13:12:39 2008
New Revision: 608233

URL: http://svn.apache.org/viewvc?rev=608233&view=rev
Log:
Merged revisions 606101 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r606101 | mmao | 2007-12-21 00:32:00 -0500 (Fri, 21 Dec 2007) | 3 lines
  
  * Using CachedOutputStream instead of byte[]
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java?rev=608233&r1=608232&r2=608233&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
Wed Jan  2 13:12:39 2008
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.attachment;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -27,15 +26,17 @@
 import javax.activation.DataSource;
 
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
 
 public class AttachmentDataSource implements DataSource {
 
-    private final String ct;
-    private final byte[] cache; 
+    private final String ct;    
+    private final CachedOutputStream cache;
     
     public AttachmentDataSource(String ctParam, InputStream inParam) throws IOException {
-        this.ct = ctParam;
-        cache = IOUtils.readBytesFromStream(inParam);
+        this.ct = ctParam;        
+        cache = new CachedOutputStream();
+        IOUtils.copy(inParam, cache);
     }
 
     public String getContentType() {
@@ -43,7 +44,12 @@
     }
 
     public InputStream getInputStream() {
-        return new DelegatingInputStream(new ByteArrayInputStream(cache));
+        try {
+            return new DelegatingInputStream(cache.getInputStream());
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
     }
 
     public String getName() {
@@ -53,6 +59,4 @@
     public OutputStream getOutputStream() throws IOException {
         throw new UnsupportedOperationException();
     }
-
-
-}
+}
\ No newline at end of file



Mime
View raw message