Repository: cxf Updated Branches: refs/heads/3.1.x-fixes fb069dc54 -> 7c8b43ab1
Minor fix # Conflicts: # core/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d199643a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d199643a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d199643a Branch: refs/heads/3.1.x-fixes Commit: d199643a412020492967ed09d96dfdb0ce0265e2 Parents: fb069dc Author: Colm O hEigeartaigh <[email protected]> Authored: Tue Apr 25 10:04:21 2017 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue Apr 25 10:53:22 2017 +0100 ---------------------------------------------------------------------- .../cxf/helpers/LoadingByteArrayOutputStream.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/d199643a/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 f981611..8654dd2 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(); - ByteBuffer bb = ByteBuffer.wrap(buf, 0, count); + 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 +}
