2003-09-25 Michael Koch <konqueror@gmx.de>

* gnu/java/nio/DatagramChannelImpl.java
	(DatagramChannelImpl): Made class final.
	(blocking): Made private.
	(socket): Made it a NIODatagramSocket and private.
	(DatagramChannelImpl): create NIODatagramSocket instead of
	DatagramSocket.
	(implConfigureBlocking): Set socket timeout.
	(connect): Check that channel is not closed.
	(write): Implemented.
	(write): Rewritten.
	(read): Implemented.
	(read): Rewritten.
	(receive): Implemented.
	(send): Implemented.
	* gnu/java/nio/SelectionKeyImpl.java
	(readyOps): Made private.
	(interestOps): Made private.
	(impl): Made private.
	(ch): Made private.
	(readyOps): Check if selection key is valid.
	(interestOps): Likewise.
	* gnu/java/nio/SelectorImpl.java
	(closed): Removed.
	(keys): Made private.
	(selected): Made private.
	(finalize): New method.
	(implCloseSelector): Rewritten.
	(keys): Return unmodifiable Set.
	(deregisterCancelledKeys): Fixed typo in method name.
	* gnu/java/nio/SocketChannelImpl.java
	(SocketChannelImpl): Made class final.
	(socket): Made it a NIOSocket and private.
	(blocking): Made private.
	(connected): Made private.
	(connectionPending): New member variable.
	(SocketChannelImpl): New implementation.
	(finalizer): Use isConnected().
	(connect): Rewritten.
	(finishConnect): Throws IOException, implemented.
	(isConnectionPending): Return connectionPending.
	(read): Rewritten.
	(write): Rewritten.
	* gnu/java/nio/NIOConstants.java: New file.
	* Makefile.am (ordinary_java_source_files):
	Added gnu/java/nio/NIOConstants.java.
	* Makefile.in: Regenerated.

From-SVN: r71769
This commit is contained in:
Michael Koch 2003-09-25 10:17:00 +00:00 committed by Michael Koch
parent 131b9f3dcd
commit 21e69789dd
8 changed files with 439 additions and 85 deletions

View file

@ -1,5 +1,5 @@
/* SelectionKeyImpl.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.nio;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
@ -45,10 +46,10 @@ import java.nio.channels.spi.AbstractSelectionKey;
public class SelectionKeyImpl extends AbstractSelectionKey
{
int fd;
int readyOps;
int interestOps;
SelectorImpl impl;
SelectableChannel ch;
private int readyOps;
private int interestOps;
private SelectorImpl impl;
private SelectableChannel ch;
public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl, int fd)
{
@ -64,22 +65,34 @@ public class SelectionKeyImpl extends AbstractSelectionKey
public int readyOps ()
{
if (!isValid())
throw new CancelledKeyException();
return readyOps;
}
public SelectionKey readyOps (int ops)
{
if (!isValid())
throw new CancelledKeyException();
readyOps = ops;
return this;
}
public int interestOps ()
{
if (!isValid())
throw new CancelledKeyException();
return interestOps;
}
public SelectionKey interestOps (int ops)
{
if (!isValid())
throw new CancelledKeyException();
interestOps = ops;
return this;
}