< prev index next >
src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java
Print this page
*** 43,52 ****
--- 43,53 ----
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import static java.nio.file.StandardOpenOption.*;
import static java.nio.file.StandardCopyOption.*;
+ import jdk.internal.io.IOSupport;
/**
* Base class for Path implementation of jrt file systems.
*
* @implNote This class needs to maintain JDK 8 source compatibility.
*** 791,805 ****
// create directory or file
target.createDirectory();
} else {
try (InputStream is = jrtfs.newInputStream(this);
OutputStream os = target.newOutputStream()) {
! byte[] buf = new byte[8192];
! int n;
! while ((n = is.read(buf)) != -1) {
! os.write(buf, 0, n);
! }
}
}
if (copyAttrs) {
BasicFileAttributeView view =
Files.getFileAttributeView(target, BasicFileAttributeView.class);
--- 792,802 ----
// create directory or file
target.createDirectory();
} else {
try (InputStream is = jrtfs.newInputStream(this);
OutputStream os = target.newOutputStream()) {
! IOSupport.copy(is, os);
}
}
if (copyAttrs) {
BasicFileAttributeView view =
Files.getFileAttributeView(target, BasicFileAttributeView.class);
< prev index next >