@Test public void testRead_3args() throws Exception { System.out.println("read"); ByteBuffer[] dsts = null; int offset = 0; int length = 0; try { long result = instance.read(dsts, offset, length); Assert.fail("exception expected"); } catch (UnsupportedOperationException e) { } }
public int read(ByteBuffer dst) throws IOException { int bytesRead = 0; while (selector.select(readTimeout) > 0) { if (log.isDebugEnabled()) { log.debug("Loop " + bytesRead); } if (selector.selectedKeys() != null) { selector.selectedKeys().remove(channelKey); } int cnt = channel.read(dst); if (cnt < 1) { if (bytesRead < 1) { bytesRead = -1; } return bytesRead; } else { bytesRead += cnt; if (!fastFirstPacketRead) { fastFirstPacketRead = true; return bytesRead; } } } if (bytesRead < 1) { throw new SocketTimeoutException("Timeout exceeded while reading from socket"); } return bytesRead; }
DatagramChannelWithTimeouts extends DatagramChannel { public int read(ByteBuffer dst) throws IOException { int bytesRead = 0; while (selector.select(readTimeout) > 0) { if (log.isDebugEnabled()) { log.debug("Loop " + bytesRead); } if (selector.selectedKeys() != null) { selector.selectedKeys().remove(channelKey); } int cnt = channel.read(dst); if (cnt < 1) { if (bytesRead < 1) { bytesRead = -1; } return bytesRead; } else { bytesRead += cnt; if (!fastFirstPacketRead) { fastFirstPacketRead = true; return bytesRead; } } } if (bytesRead < 1) { throw new SocketTimeoutException("Timeout exceeded while reading from socket"); } return bytesRead; } }
DatagramChannelWithTimeouts extends DatagramChannel { public int read(ByteBuffer dst) throws IOException { int bytesRead = 0; while (selector.select(readTimeout) > 0) { if (log.isDebugEnabled()) { log.debug("Loop " + bytesRead); } if (selector.selectedKeys() != null) { selector.selectedKeys().remove(channelKey); } int cnt = channel.read(dst); if (cnt < 1) { if (bytesRead < 1) { bytesRead = -1; } return bytesRead; } else { bytesRead += cnt; if (!fastFirstPacketRead) { fastFirstPacketRead = true; return bytesRead; } } } if (bytesRead < 1) { throw new SocketTimeoutException("Timeout exceeded while reading from socket"); } return bytesRead; } protected  DatagramChannelWithTimeouts(); }
DatagramChannelWithTimeouts extends DatagramChannel { public int read(ByteBuffer dst) throws IOException { int bytesRead = 0; while (selector.select(readTimeout) > 0) { if (log.isDebugEnabled()) { log.debug("Loop " + bytesRead); } if (selector.selectedKeys() != null) { selector.selectedKeys().remove(channelKey); } int cnt = channel.read(dst); if (cnt < 1) { if (bytesRead < 1) { bytesRead = -1; } return bytesRead; } else { bytesRead += cnt; if (!fastFirstPacketRead) { fastFirstPacketRead = true; return bytesRead; } } } if (bytesRead < 1) { throw new SocketTimeoutException("Timeout exceeded while reading from socket"); } return bytesRead; } protected  DatagramChannelWithTimeouts(); static DatagramChannel open(); @Override DatagramChannel bind(SocketAddress socketAddress); @Override SocketAddress getLocalAddress(); @Override DatagramChannel setOption(SocketOption<T> socketOption, T t); @Override T getOption(SocketOption<T> socketOption); @Override Set<SocketOption<?>> supportedOptions(); int read(ByteBuffer dst); long read(ByteBuffer[] dsts, int offset, int length); int write(ByteBuffer src); long write(ByteBuffer[] srcs, int offset, int length); boolean isConnected(); void setReadTimeout(int t); DatagramSocket socket(); DatagramChannel disconnect(); SocketAddress receive(ByteBuffer dst); int send(ByteBuffer src, SocketAddress target); DatagramChannel connect(SocketAddress remote); SocketAddress getRemoteAddress(); @Override MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface); @Override MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface, InetAddress inetAddress1); }
DatagramChannelWithTimeouts extends DatagramChannel { public int read(ByteBuffer dst) throws IOException { int bytesRead = 0; while (selector.select(readTimeout) > 0) { if (log.isDebugEnabled()) { log.debug("Loop " + bytesRead); } if (selector.selectedKeys() != null) { selector.selectedKeys().remove(channelKey); } int cnt = channel.read(dst); if (cnt < 1) { if (bytesRead < 1) { bytesRead = -1; } return bytesRead; } else { bytesRead += cnt; if (!fastFirstPacketRead) { fastFirstPacketRead = true; return bytesRead; } } } if (bytesRead < 1) { throw new SocketTimeoutException("Timeout exceeded while reading from socket"); } return bytesRead; } protected  DatagramChannelWithTimeouts(); static DatagramChannel open(); @Override DatagramChannel bind(SocketAddress socketAddress); @Override SocketAddress getLocalAddress(); @Override DatagramChannel setOption(SocketOption<T> socketOption, T t); @Override T getOption(SocketOption<T> socketOption); @Override Set<SocketOption<?>> supportedOptions(); int read(ByteBuffer dst); long read(ByteBuffer[] dsts, int offset, int length); int write(ByteBuffer src); long write(ByteBuffer[] srcs, int offset, int length); boolean isConnected(); void setReadTimeout(int t); DatagramSocket socket(); DatagramChannel disconnect(); SocketAddress receive(ByteBuffer dst); int send(ByteBuffer src, SocketAddress target); DatagramChannel connect(SocketAddress remote); SocketAddress getRemoteAddress(); @Override MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface); @Override MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface, InetAddress inetAddress1);  }