You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/04/25 09:52:48 UTC

cxf git commit: Minor fix

Repository: cxf
Updated Branches:
  refs/heads/master 4494a00d6 -> 7fb37afad


Minor fix


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7fb37afa
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7fb37afa
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7fb37afa

Branch: refs/heads/master
Commit: 7fb37afad09df07e7a530be1d660f0b38d716255
Parents: 4494a00
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Apr 25 10:04:21 2017 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Apr 25 10:04:27 2017 +0100

----------------------------------------------------------------------
 .../cxf/helpers/LoadingByteArrayOutputStream.java     | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/7fb37afa/core/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java b/core/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
index 39607fe..7d27038 100644
--- a/core/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
+++ b/core/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
@@ -22,10 +22,12 @@ package org.apache.cxf.helpers;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
+import java.nio.channels.Channels;
+import java.nio.channels.WritableByteChannel;
+import java.nio.file.Files;
 
 import org.apache.cxf.io.Transferable;
 
@@ -60,14 +62,14 @@ public class LoadingByteArrayOutputStream extends ByteArrayOutputStream {
 
         @Override
         public void transferTo(File file) throws IOException {
-            FileOutputStream fout = new FileOutputStream(file);
-            FileChannel channel = fout.getChannel();
+            OutputStream out = Files.newOutputStream(file.toPath());
+            WritableByteChannel channel = Channels.newChannel(out);
             ByteBuffer bb = ByteBuffer.wrap(buf, 0, count);
             while (bb.hasRemaining()) {
                 channel.write(bb);
             }
             channel.close();
-            fout.close();
+            out.close();
         }
 
     }
@@ -90,4 +92,4 @@ public class LoadingByteArrayOutputStream extends ByteArrayOutputStream {
     public byte[] getRawBytes() {
         return buf;
     }
-}
\ No newline at end of file
+}