This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] java.nio.channels


Hi list,

I've commited the attached fixes. This merges some classes with 
Classpath.


Michael
-- 
Homepage: http://www.worldforge.org/
GPG-key: http://konqueror.dyndns.org/~mkoch/michael.gpg
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1529
diff -b -u -r1.1529 ChangeLog
--- ChangeLog	13 Nov 2002 12:21:23 -0000	1.1529
+++ ChangeLog	13 Nov 2002 13:51:55 -0000
@@ -1,3 +1,81 @@
+2002-11-13  Michael Koch <konqueror@gmx.de>
+
+	* java/nio/channels/AlreadyConnectedException.java:
+	Removed unneeded import.
+	(AlreadyConnectedException): Documentation added.
+	* java/nio/channels/Pipe.java
+	(SinkChannel.SinkChannel): Documentation added.
+	(SinkChannel.validOps): New method.
+	(SourceChannel.SourceChannel): Documentation added.
+	(SourceChannel.validOps): New method.
+	(Pipe): Documentation added.
+	(open): Documentation added.
+	(SinkChannel.channel): Documentation added.
+	(SourceChannel.channel): Documentation added.
+	* java/nio/channel/SelectableChannel.java
+	(SelectableChannel): Documentation added.
+	(blockingLock): Documentation added.
+	(configureBlocking):Documentation added.
+	(isBlocking):Documentation added.
+	(isRegistered):Documentation added.
+	(keyFor):Documentation added.
+	(provider):Documentation added.
+	(register): Documentation added.
+	(validOps): Documentation added.
+	* jaba/nio/channels/SelectionKey.java
+	(SelectionKey): Documentation added.
+	(attach): Documentation added.
+	(attachment): Documentation added.
+	(isAcceptable): Documentation added.
+	(isConnetable): Documentation added.
+	(isReadable): Documentation added.
+	(isWritable): Documentation added.
+	(cancel): Documentation added.
+	(channel): Documentation added.
+	(interestOps): Documentation added.
+	(isValid): Documentation added.
+	(readyOps): Documentation added.
+	(selector): Documentation added.
+	* jaba/nio/channels/Selector.java
+	(Selector): Documentation added.
+	(open): Documentation added.
+	(close): Documentation added.
+	(isOpen): Documentation added.
+	(keys): Documentation added.
+	(provider): Documentation added.
+	(select): Documentation added.
+	(selectedKeys): Documentation added.
+	(selectNow): Documentation added.
+	(wakeup): Documentation added.
+	* java/nio/channels/spi/AbstractInterruptibleChannel.java
+	(AbstractInterruptibleChannel): Documentation added.
+	(opened): Default to true;
+	(begin): Documentation added.
+	(close): Set opened to false, documentation added.
+	(isOpen): Documentation added.
+	* java/nio/channels/spi/AbstractSelectionKey.java
+	(AbstractSelectionKey): Documentation added.
+	(cancel): Documentation added.
+	(isValid): Documentation added.
+	* java/nio/channels/spi/AbstractSelector.java
+	(AbstractSelector): Documentation added.
+	(begin): Documentation added.
+	(close): Documentation added.
+	(isOpen): Documentation added.
+	(deregister): Documentation added.
+	(end): Documentation added.
+	(provider): Documentation added.
+	(implCloseSelector): Documentation added.
+	(register): Documentation added.
+	* java/nio/channels/spi/SelectorProvider.java
+	(SelectorProvider): Documentation added.
+	(openDatagramChannel): Documentation added.
+	(openPipe): Documentation added.
+	(openSelector): Documentation added.
+	(openServerSocketChannel): Documentation added.
+	(openSocketChannel): Documentation added.
+	(provider): Documentation added.
+
 2002-11-12  Michael Koch <konqueror@gmx.de>
 
 	* java/nio/Buffer.java: Implemented.
Index: java/nio/channels/AlreadyConnectedException.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/AlreadyConnectedException.java,v
retrieving revision 1.2
diff -b -u -r1.2 AlreadyConnectedException.java
--- java/nio/channels/AlreadyConnectedException.java	3 Nov 2002 21:18:32 -0000	1.2
+++ java/nio/channels/AlreadyConnectedException.java	13 Nov 2002 13:51:55 -0000
@@ -37,11 +37,11 @@
 
 package java.nio.channels;
 
-import java.io.*;
-
-
 public class AlreadyConnectedException extends IllegalStateException
 {
+  /**
+   * Creates the exception
+   */
   public AlreadyConnectedException()
   {
   }
Index: java/nio/channels/Pipe.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/Pipe.java,v
retrieving revision 1.1
diff -b -u -r1.1 Pipe.java
--- java/nio/channels/Pipe.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/Pipe.java	13 Nov 2002 13:51:55 -0000
@@ -40,40 +40,82 @@
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.nio.channels.spi.SelectorProvider;
 
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
 public abstract class Pipe
 {
   public abstract static class SinkChannel
     extends AbstractSelectableChannel
     implements WritableByteChannel, GatheringByteChannel
   {
-    protected SinkChannel(SelectorProvider provider)
+    /**
+     * Initializes the channel.
+     */
+    protected SinkChannel (SelectorProvider provider)
     {
       super (provider);
     }
+
+    /**
+     * Returns an operation set that is valid on this channel.
+     *
+     * The only valid operation on this channel is @see SelectionKey.OP_WRITE.
+     */
+    public final int validOps ()
+    {
+      return SelectionKey.OP_WRITE;
+    }
   }
 
   public abstract static class SourceChannel
     extends AbstractSelectableChannel
     implements ReadableByteChannel, ScatteringByteChannel
   {
-    protected SourceChannel(SelectorProvider provider)
+    /**
+     * Initializes the channel.
+     */
+    protected SourceChannel (SelectorProvider provider)
     {
       super (provider);
     }
+
+    /**
+     * Returns an operation set that is valid on this channel.
+     *
+     * The only valid operation on this channel is @see SelectionKey.OP_READ.
+     */
+    public final int validOps ()
+    {
+      return SelectionKey.OP_READ;
+    }
   }
     
+  /**
+   * Initializes the pipe.
+   */
   protected Pipe()
   {
   }
 
   /**
+   * Opens a pipe.
+   * 
    * @exception IOException If an error occurs
    */
   public static Pipe open()
   {
-    return null;
+    return SelectorProvider.provider ().openPipe();
   }
     
+  /**
+   * Returns a pipe's sink channel.
+   */
   public abstract Pipe.SinkChannel sink();
+
+  /**
+   * Returns a pipe's source channel
+   */
   public abstract Pipe.SourceChannel source();   
 }
Index: java/nio/channels/SelectableChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/SelectableChannel.java,v
retrieving revision 1.1
diff -b -u -r1.1 SelectableChannel.java
--- java/nio/channels/SelectableChannel.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/SelectableChannel.java	13 Nov 2002 13:51:55 -0000
@@ -40,50 +40,99 @@
 import java.nio.channels.spi.AbstractInterruptibleChannel;
 import java.nio.channels.spi.SelectorProvider;
 
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
 public abstract class SelectableChannel
   extends AbstractInterruptibleChannel
 {
-  protected SelectableChannel()
+  /**
+   * Initializes the channel.
+   */
+  protected SelectableChannel ()
   {
   }
   
-  public abstract  Object blockingLock();
+  /**
+   * Returns the lock of this channel.
+   */
+  public abstract Object blockingLock ();
 
   /**
-   * @exception ClosedChannelException FIXME
-   * @exception IllegalBlockingModeException FIXME
-   * @exception IOException FIXME
+   * Adjusts this channel's blocking mode.
+   * 
+   * @exception ClosedChannelException If this channel is closed.
+   * @exception IllegalBlockingModeException If block is true and this channel
+   * is registered with one or more selectors.
+   * @exception IOException If an error occurs.
    */
-  public abstract  SelectableChannel configureBlocking(boolean block);
+  public abstract SelectableChannel configureBlocking (boolean block);
   
-  public abstract  boolean isBlocking();
+  /**
+   * Tells whether this channel is blocking or not.
+   */
+  public abstract boolean isBlocking ();
   
-  public abstract  boolean isRegistered();
+  /**
+   * Tells whether or not this channel is currently registered with
+   * any selectors.
+   */
+  public abstract boolean isRegistered ();
   
-  public abstract  SelectionKey keyFor(Selector sel);
+  /**
+   * Retrieves the key representing the channel's registration with
+   * the given selector.
+   */
+  public abstract SelectionKey keyFor (Selector sel);
   
-  public abstract  SelectorProvider provider();
+  /**
+   * Returns the provider that created this channel.
+   */
+  public abstract SelectorProvider provider ();
   
   /**
-   * @exception CancelledKeyException FIXME
-   * @exception ClosedChannelException FIXME
-   * @exception IllegalArgumentException FIXME
-   * @exception IllegalBlockingModeException FIXME
-   * @exception IllegalSelectorException FIXME
+   * Registers this channel with the given selector,
+   * returning a selection key.
+   * 
+   * @exception CancelledKeyException If this channel is currently registered
+   * with the given selector but the corresponding key has already been cancelled
+   * @exception ClosedChannelException If this channel is closed.
+   * @exception IllegalArgumentException If a bit in ops does not correspond
+   * to an operation that is supported by this channel, that is, if
+   * set &amp; ~validOps() != 0.
+   * @exception IllegalBlockingModeException If block is true and this channel
+   * is registered with one or more selectors.
+   * @exception IllegalSelectorException If this channel was not created by
+   * the same provider as the given selector.
    */
-  public final SelectionKey register(Selector sel, int ops) throws java.nio.channels.ClosedChannelException
+  public final SelectionKey register (Selector sel, int ops)
+    throws ClosedChannelException
   {
-    return register(sel, ops, null);
+    return register (sel, ops, null);
   }
   
   /**
-   * @exception CancelledKeyException FIXME
-   * @exception ClosedChannelException FIXME
-   * @exception IllegalArgumentException FIXME
-   * @exception IllegalBlockingModeException FIXME
-   * @exception IllegalSelectorException FIXME
+   * Registers this channel with the given selector,
+   * returning a selection key.
+   *
+   * @exception CancelledKeyException If this channel is currently registered
+   * with the given selector but the corresponding key has already been
+   * cancelled.
+   * @exception ClosedChannelException If this channel is closed.
+   * @exception IllegalArgumentException If a bit in ops does not correspond
+   * to an operation that is supported by this channel, that is, if
+   * set &amp; ~validOps() != 0.
+   * @exception IllegalBlockingModeException If block is true and this channel
+   * is registered with one or more selectors.
+   * @exception IllegalSelectorException If this channel was not created by
+   * the same provider as the given selector.
    */
-  public abstract  SelectionKey register(Selector sel, int ops, Object att) throws java.nio.channels.ClosedChannelException;
+  public abstract SelectionKey register (Selector sel, int ops, Object att)
+    throws ClosedChannelException;
   
+  /**
+   * Returns a set of valid operations on this channel.
+   */
   public abstract  int validOps();  
 }
Index: java/nio/channels/SelectionKey.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/SelectionKey.java,v
retrieving revision 1.1
diff -b -u -r1.1 SelectionKey.java
--- java/nio/channels/SelectionKey.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/SelectionKey.java	13 Nov 2002 13:51:55 -0000
@@ -37,6 +37,10 @@
 
 package java.nio.channels;
 
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
 public abstract class SelectionKey
 {
   public static final int OP_ACCEPT  = 1<<0;
@@ -46,75 +50,115 @@
     
   Object attached;
     
-  protected SelectionKey()
+  /**
+   * Initializes the selection key.
+   */
+  protected SelectionKey ()
   {
   }
 
-  public final Object attach(Object obj)
+  /**
+   * Attaches obj to the key and returns the old attached object.
+   */
+  public final Object attach (Object obj)
   {
     Object old = attached;
     attached = obj;
     return old;
   }
     
-  public final Object attachment()
+  /**
+   * Returns the object attached to the key.
+   */
+  public final Object attachment ()
   {
     return attached;
   }    
 
   /**
-   * @exception CancelledKeyException FIXME
+   * Tests if the channel attached to this key is ready to accept
+   * a new socket connection.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public final boolean isAcceptable()
+  public final boolean isAcceptable ()
   { 
-    return (readyOps() & OP_ACCEPT) != 0;
+    return (readyOps () & OP_ACCEPT) != 0;
   }
 
   /**
-   * @exception CancelledKeyException FIXME
+   * Tests whether this key's channel has either finished,
+   * or failed to finish, its socket-connection operation.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public final boolean isConnectable()
+  public final boolean isConnectable ()
   {
-    return (readyOps() & OP_CONNECT) != 0;  
+    return (readyOps () & OP_CONNECT) != 0;  
   }        
   
   /**
-   * @exception CancelledKeyException FIXME
+   * Tests if the channel attached to the key is readable.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public final boolean isReadable()
+  public final boolean isReadable ()
   {
-    return (readyOps() & OP_READ) != 0; 
+    return (readyOps () & OP_READ) != 0; 
   }
   
   /**
-   * @exception CancelledKeyException FIXME
+   * Tests if the channel attached to the key is writable.
+   *
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public final boolean isWritable()
+  public final boolean isWritable ()
   {
-    return (readyOps() & OP_WRITE) != 0;
+    return (readyOps () & OP_WRITE) != 0;
   }
 
-  public abstract void cancel(); 
+  /**
+   * Requests that the registration of this key's channel with
+   * its selector be cancelled.
+   */
+  public abstract void cancel (); 
   
-  public abstract SelectableChannel channel();
+  /**
+   * return the channel attached to the key.
+   */
+  public abstract SelectableChannel channel ();
   
   /**
-   * @exception CancelledKeyException FIXME
+   * Returns the key's interest set.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public abstract int interestOps();
+  public abstract int interestOps ();
   
   /**
-   * @exception CancelledKeyException FIXME
-   * @exception IllegalArgumentException FIXME
+   * Sets this key's interest set to the given value.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
+   * @exception IllegalArgumentException If a bit in the set does not
+   * correspond to an operation that is supported by this key's channel,
+   * that is, if set &amp; ~(channel().validOps()) != 0
    */
-  public abstract SelectionKey interestOps(int ops);
+  public abstract SelectionKey interestOps (int ops);
   
-  public abstract boolean isValid();
+  /**
+   * Tells whether or not this key is valid.
+   */
+  public abstract boolean isValid ();
  
   /**
-   * @exception CancelledKeyException FIXME
+   * Retrieves this key's ready-operation set.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public abstract int readyOps();
+  public abstract int readyOps ();
   
-  public abstract Selector selector();
+  /**
+   * Returns the selector for which this key was created.
+   */
+  public abstract Selector selector ();
 }
Index: java/nio/channels/Selector.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/Selector.java,v
retrieving revision 1.1
diff -b -u -r1.1 Selector.java
--- java/nio/channels/Selector.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/Selector.java	13 Nov 2002 13:51:55 -0000
@@ -37,60 +37,97 @@
 
 package java.nio.channels;
 
-import java.util.Set;
+import java.io.IOException;
 import java.nio.channels.spi.SelectorProvider;
+import java.util.Set;
 
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
 public abstract class Selector
 {
+  /**
+   * Initializes the selector.
+   */
   protected Selector()
   {
   }
  
   /**
+   * Opens a selector.
+   * 
    * @exception IOException If an error occurs
    */
-  public static Selector open()
+  public static Selector open ()
   {
-	return SelectorProvider.provider().openSelector();
+    return SelectorProvider.provider ().openSelector ();
   }
 
   /**
+   * Closes the selector.
+   * 
    * @exception IOException If an error occurs
    */
-  public abstract void close();
+  public abstract void close () throws IOException;
   
-  public abstract boolean isOpen();
+  /**
+   * Tells whether the selector is open or not.
+   */
+  public abstract boolean isOpen ();
   
   /**
-   * @exception ClosedSelectorException FIXME
+   * Returns this selector's key set.
+   * 
+   * @exception ClosedSelectorException If this selector is closed.
    */
-  public abstract Set keys();
+  public abstract Set keys ();
   
-  public abstract SelectorProvider provider();
+  /**
+   * Returns the SelectorProvider that created the selector.
+   */
+  public abstract SelectorProvider provider ();
   
   /**
-   * @exception ClosedSelectorException FIXME
+   * Selects a set of keys whose corresponding channels are ready
+   * for I/O operations.
+   * 
+   * @exception ClosedSelectorException If this selector is closed.
    * @exception IOException If an error occurs
    */
-  public abstract int select();
+  public abstract int select () throws IOException;
   
   /**
-   * @exception ClosedSelectorException FIXME
-   * @exception IllegalArgumentException FIXME
+   * Selects a set of keys whose corresponding channels are ready
+   * for I/O operations.
+   *
+   * @param timeout The timeout to use.
+   * 
+   * @exception ClosedSelectorException If this selector is closed.
+   * @exception IllegalArgumentException If the timeout value is negative.
    * @exception IOException If an error occurs
    */
-  public abstract int select(long timeout);
+  public abstract int select (long timeout) throws IOException;
   
   /**
-   * @exception ClosedSelectorException FIXME
+   * Returns this selector's selected-key set.
+   * 
+   * @exception ClosedSelectorException If this selector is closed.
    */
-  public abstract Set selectedKeys();
+  public abstract Set selectedKeys ();
   
   /**
-   * @exception ClosedSelectorException FIXME
+   * Selects a set of keys whose corresponding channels are ready
+   * for I/O operations.
+   * 
+   * @exception ClosedSelectorException If this selector is closed.
    * @exception IOException If an error occurs
    */
-  public abstract int selectNow();
+  public abstract int selectNow () throws IOException;
   
-  public abstract Selector wakeup();
+  /**
+   * Causes the first selection operation that has not yet returned to
+   * return immediately.
+   */
+  public abstract Selector wakeup ();
 }
Index: java/nio/channels/spi/AbstractInterruptibleChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java,v
retrieving revision 1.1
diff -b -u -r1.1 AbstractInterruptibleChannel.java
--- java/nio/channels/spi/AbstractInterruptibleChannel.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/spi/AbstractInterruptibleChannel.java	13 Nov 2002 13:51:55 -0000
@@ -41,47 +41,64 @@
 import java.nio.channels.Channel;
 import java.nio.channels.InterruptibleChannel;
 
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
 public abstract class AbstractInterruptibleChannel
   implements Channel, InterruptibleChannel
 {
-  boolean opened = false;
+  boolean opened = true;
 
-  protected AbstractInterruptibleChannel()
+  /**
+   * Initializes the channel.
+   */
+  protected AbstractInterruptibleChannel ()
   {
   }
 
-  protected final void begin()
+  /**
+   * Marks the beginning of an I/O operation that might block indefinitely.
+   */
+  protected final void begin ()
   {
-    // Marks the beginning of an I/O operation that might block indefinitely.
   }
     
   /**
+   * Closes the channel.
+   * 
    * @exception IOException If an error occurs
    */
-  public final void close() throws IOException
+  public final void close () throws IOException
   {
-    // Closes this channel.
-    implCloseChannel();
+    opened = false;
+    implCloseChannel ();
   }
 
   /**
-   * @exception AsynchronousCloseException FIXME
-   * @exception ClosedByInterruptException FIXME
+   * Marks the end of an I/O operation that might block indefinitely.
+   * 
+   * @exception AsynchronousCloseException If the channel was asynchronously
+   * closed.
+   * @exception ClosedByInterruptException If the thread blocked in the
+   * I/O operation was interrupted.
    */
-  protected final void end(boolean completed)
+  protected final void end (boolean completed)
   {
-    // Marks the end of an I/O operation that might block indefinitely.
   }   
 
   /**
+   * Closes the channel.
+   * 
    * @exception IOException If an error occurs
    */
-  protected abstract void implCloseChannel() throws IOException;
+  protected abstract void implCloseChannel () throws IOException;
 
-  public final boolean isOpen()
+  /**
+   * Tells whether or not this channel is open.
+   */
+  public final boolean isOpen ()
   {
-    // Tells whether or not this channel is open.
     return opened;
   }
 }
-
Index: java/nio/channels/spi/AbstractSelectionKey.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/AbstractSelectionKey.java,v
retrieving revision 1.1
diff -b -u -r1.1 AbstractSelectionKey.java
--- java/nio/channels/spi/AbstractSelectionKey.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/spi/AbstractSelectionKey.java	13 Nov 2002 13:51:55 -0000
@@ -39,28 +39,37 @@
 
 import java.nio.channels.SelectionKey;
 
+/**
+ * @since 1.4
+ */
 public abstract class AbstractSelectionKey
   extends SelectionKey
 {
   boolean ok = true;
 
+  /**
+   * Initializes the key.
+   */
   protected AbstractSelectionKey ()
   {
   }
  
+  /**
+   * Cancels this key.
+   */
   public final void cancel ()
   {
     if (ok)
-      {
         selector ().selectedKeys ().add (this);
-      }
     
     ok = false;
   }
 
+  /**
+   * Tells whether this key is valid or not.
+   */
   public final boolean isValid ()
   {
     return ok;
   }
 }
-
Index: java/nio/channels/spi/AbstractSelector.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/AbstractSelector.java,v
retrieving revision 1.1
diff -b -u -r1.1 AbstractSelector.java
--- java/nio/channels/spi/AbstractSelector.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/spi/AbstractSelector.java	13 Nov 2002 13:51:55 -0000
@@ -37,6 +37,7 @@
 
 package java.nio.channels.spi;
 
+import java.io.IOException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.util.List;
@@ -44,44 +45,56 @@
 
 public abstract class AbstractSelector extends Selector
 {
-  boolean closed = true;
+  boolean closed = false;
   SelectorProvider provider;
 
-  protected AbstractSelector(SelectorProvider provider)
+  /**
+   * Initializes the slector.
+   */
+  protected AbstractSelector (SelectorProvider provider)
   {
     this.provider = provider;
   }
  
-  protected final void begin()
+  /**
+   * Marks the beginning of an I/O operation that might block indefinitely.
+   */
+  protected final void begin ()
   {
   }
 
   /**
+   * Closes the channel.
+   * 
    * @exception IOException If an error occurs
    */
-  public final void close()
+  public final void close () throws IOException
   {
     if (closed)
       return;
+    
     closed = true;
-    implCloseSelector();
+    implCloseSelector ();
   }
 
-  protected final void deregister(AbstractSelectionKey key)
+  /**
+   * Tells whether this channel is open or not.
+   */
+  public final boolean isOpen ()
   {
-    cancelledKeys().remove(key);
+    return ! closed;
   }
     
-  protected final void end()
+  protected final void deregister (AbstractSelectionKey key)
   {
+    cancelledKeys ().remove (key);
   }
     
-  public final boolean isOpen()
+  protected final void end()
   {
-    return ! closed;
   }
     
-  public final SelectorProvider provider()
+  public final SelectorProvider provider ()
   {
     return provider;
   }
@@ -92,9 +105,10 @@
   }
   
   /**
-   * @exception IOException If an error occurs
+   * Closes the channel.
    */
-  protected abstract void implCloseSelector();	
+  protected abstract void implCloseSelector () throws IOException;
   
-  protected abstract SelectionKey register(AbstractSelectableChannel ch, int ops, Object att);   
+  protected abstract SelectionKey register (AbstractSelectableChannel ch,
+                                            int ops, Object att);   
 }
Index: java/nio/channels/spi/SelectorProvider.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/SelectorProvider.java,v
retrieving revision 1.1
diff -b -u -r1.1 SelectorProvider.java
--- java/nio/channels/spi/SelectorProvider.java	1 Nov 2002 12:03:39 -0000	1.1
+++ java/nio/channels/spi/SelectorProvider.java	13 Nov 2002 13:51:55 -0000
@@ -1,4 +1,4 @@
-/* SelectorProvider.java -- 
+/* SelectorProvider.java
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,12 +37,14 @@
 
 package java.nio.channels.spi;
 
+/* import gnu.java.nio.channels.SelectorProviderImpl; */
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.Pipe;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 
 /**
+ * @author Michael Koch
  * @since 1.4
  */
 public abstract class SelectorProvider
@@ -50,33 +52,52 @@
   static SelectorProvider pr;
     
   /**
-   * Creates the <code>SelectorProvider<code> object
+   * Initializes the selector provider.
    *
    * @exception SecurityException If a security manager has been installed and
-   * it denies RuntimePermission("selectorProvider")
+   * it denies @see RuntimePermission ("selectorProvider").
    */
-  protected SelectorProvider()
+  protected SelectorProvider ()
   {
     SecurityManager sm = System.getSecurityManager ();
     if (sm != null)
       sm.checkPermission (new RuntimePermission ("selectorProvider"));
   }
     
-  public abstract  DatagramChannel openDatagramChannel();
+  /**
+   * Opens a datagram channel.
+   */
+  public abstract DatagramChannel openDatagramChannel ();
 
-  public abstract  Pipe openPipe();
+  /**
+   * Opens a pipe.
+   */
+  public abstract Pipe openPipe ();
   
-  public abstract  AbstractSelector openSelector();
+  /**
+   * Opens a selector.
+   */
+  public abstract AbstractSelector openSelector ();
   
-  public abstract  ServerSocketChannel openServerSocketChannel();
+  /**
+   * Opens a server socket channel.
+   */
+  public abstract ServerSocketChannel openServerSocketChannel ();
   
-  public abstract  SocketChannel openSocketChannel();
+  /**
+   * Opens a socket channel.
+   */
+  public abstract SocketChannel openSocketChannel ();
    
   /**
-   * Returns the global <code>SelectorProvider</code> object
+   * Returns the system-wide default selector provider for this invocation
+   * of the Java virtual machine.
    */
-  public static SelectorProvider provider()
+  public static SelectorProvider provider ()
   {
+/*    if (pr == null) */
+/*      pr = new SelectorProviderImpl (); */
+    
     return pr;
   }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]