diff options
Diffstat (limited to 'gnu/java/nio/FileChannelImpl.java')
| -rw-r--r-- | gnu/java/nio/FileChannelImpl.java | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/gnu/java/nio/FileChannelImpl.java b/gnu/java/nio/FileChannelImpl.java index 42efcd0be..419124050 100644 --- a/gnu/java/nio/FileChannelImpl.java +++ b/gnu/java/nio/FileChannelImpl.java @@ -253,18 +253,7 @@ public final class FileChannelImpl extends FileChannel public long read (ByteBuffer[] dsts, int offset, int length) throws IOException { - int n = offset + length; - long read = 0; - if (offset < 0 || length < 0 || n > dsts.length) - throw new ArrayIndexOutOfBoundsException(); - for (int i = offset; i < n; i++) - { - int ret = read(dsts[i]); - if (ret == -1) - break; - read += ret; - } - return read; + return ch.readScattering(dsts, offset, length); } public int write (ByteBuffer src) throws IOException @@ -303,13 +292,7 @@ public final class FileChannelImpl extends FileChannel public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { - int n = offset + length; - long written = 0; - if (offset < 0 || length < 0 || n > srcs.length) - throw new ArrayIndexOutOfBoundsException(); - for (int i = offset; i < n; i++) - written += write(srcs[i]); - return written; + return ch.writeGathering(srcs, offset, length); } public MappedByteBuffer map (FileChannel.MapMode mode, |
