Skip to content

Commit

Permalink
Fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
circlespainter committed Feb 16, 2016
1 parent ef32806 commit 4455b11
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/DaemonCapsule.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Capsule
* Copyright (c) 2015, Parallel Universe Software Co. and Contributors. All rights reserved.
* Copyright (c) 2015-2016, Parallel Universe Software Co. and Contributors. All rights reserved.
*
* This program and the accompanying materials are licensed under the terms
* of the Eclipse Public License v1.0, available at
Expand All @@ -13,10 +13,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.*;
import java.nio.file.attribute.FileTime;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -205,7 +202,7 @@ private static Path copy(String filename, String resourceDir, Path targetDir, Op
final Path f = targetDir.resolve(filename);
Files.createDirectories(f.getParent());
try (final OutputStream out = Files.newOutputStream(f, opts)) {
copy(in, out);
copy0(in, out);
final Path ret = targetDir.resolve(filename);
//noinspection ResultOfMethodCallIgnored
ret.toFile().setExecutable(true);
Expand Down Expand Up @@ -825,5 +822,11 @@ private static InputStream skipToZipStart(InputStream is, OutputStream os) throw
return is;
}

private static void copy0(InputStream is, OutputStream out) throws IOException {
final byte[] buffer = new byte[1024];
for (int bytesRead; (bytesRead = is.read(buffer)) != -1;)
out.write(buffer, 0, bytesRead);
out.flush();
}
//</editor-fold>
}

0 comments on commit 4455b11

Please sign in to comment.