2004-11-21 Michael Koch <konqueror@gmx.de>

* gnu/java/nio/SocketChannelImpl.java
	(read): Only return 0 when no bytes for reading available in
	non-blocking mode.
	* java/nio/channels/SocketChannel.java:
	Added some missing @return tags.

From-SVN: r90986
This commit is contained in:
Michael Koch
2004-11-21 20:19:59 +00:00
committed by Michael Koch
parent 7fe16580f0
commit 926253eeca
3 changed files with 42 additions and 7 deletions
+3 -3
View File
@@ -182,7 +182,7 @@ public final class SocketChannelImpl extends SocketChannel
// FIXME: Handle blocking/non-blocking mode.
Selector selector = provider().openSelector();
register (selector, SelectionKey.OP_CONNECT);
register(selector, SelectionKey.OP_CONNECT);
if (isBlocking())
{
@@ -216,7 +216,7 @@ public final class SocketChannelImpl extends SocketChannel
return socket;
}
public int read (ByteBuffer dst) throws IOException
public int read(ByteBuffer dst) throws IOException
{
if (!isConnected())
throw new NotYetConnectedException();
@@ -227,7 +227,7 @@ public final class SocketChannelImpl extends SocketChannel
int available = input.available();
int len = dst.capacity() - dst.position();
if (available == 0)
if (! isBlocking() && available == 0)
return 0;
if (len > available)