From 531e39762343dc00a415b75c19443bf724daac94 Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Mon, 25 Sep 2006 21:54:44 +0000 Subject: 2006-09-25 Casey Marshall * gnu/java/nio/FileChannelImpl.java (read): revert back to using `readScattering.' (write): revert back to using `writeGathering.' * vm/reference/gnu/java/nio/VMChannel.java (writeGathering): find the first buffer that has data remaining, and start at that one. --- gnu/java/nio/FileChannelImpl.java | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'gnu/java/nio/FileChannelImpl.java') 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, -- cgit v1.2.1