--- a/jdk/src/share/classes/java/nio/file/Files.java Tue Oct 08 11:17:15 2013 +0200
+++ b/jdk/src/share/classes/java/nio/file/Files.java Tue Oct 08 10:49:09 2013 +0100
@@ -3082,13 +3082,13 @@
* method is invoked to check read access to the file.
*/
public static byte[] readAllBytes(Path path) throws IOException {
- try (FileChannel fc = FileChannel.open(path);
- InputStream is = Channels.newInputStream(fc)) {
- long size = fc.size();
+ try (SeekableByteChannel sbc = Files.newByteChannel(path);
+ InputStream in = Channels.newInputStream(sbc)) {
+ long size = sbc.size();
if (size > (long)MAX_BUFFER_SIZE)
throw new OutOfMemoryError("Required array size too large");
- return read(is, (int)size);
+ return read(in, (int)size);
}
}