diff options
Diffstat (limited to 'gnu/java/nio/SocketChannelImpl.java')
-rw-r--r-- | gnu/java/nio/SocketChannelImpl.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/gnu/java/nio/SocketChannelImpl.java b/gnu/java/nio/SocketChannelImpl.java index 9f2de278d..d38b11887 100644 --- a/gnu/java/nio/SocketChannelImpl.java +++ b/gnu/java/nio/SocketChannelImpl.java @@ -193,18 +193,17 @@ public class SocketChannelImpl extends SocketChannel int bytes = 0; int len = src.position(); - if (src instanceof ByteBufferImpl) - { - ByteBufferImpl bi = (ByteBufferImpl) src; - byte[]b = bi.array(); - bytes = SocketWrite(fd, b, 0, len); - } + if (src.hasArray ()) + { + byte[] b = src.array (); + bytes = SocketWrite (fd, b, 0, len); + } else - { - byte[]b = new byte[len]; - src.get(b, 0, len); - bytes = SocketWrite(fd, b, 0, len); - } + { + byte[] b = new byte [len]; + src.get (b, 0, len); + bytes = SocketWrite (fd, b, 0, len); + } return bytes; } |