2002-11-13 Michael Koch <konqueror@gmx.de>
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Nov 2002 13:52:47 +0000 (13:52 +0000)
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Nov 2002 13:52:47 +0000 (13:52 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59077 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/nio/channels/AlreadyConnectedException.java
libjava/java/nio/channels/Pipe.java
libjava/java/nio/channels/SelectableChannel.java
libjava/java/nio/channels/SelectionKey.java
libjava/java/nio/channels/Selector.java
libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
libjava/java/nio/channels/spi/AbstractSelectionKey.java
libjava/java/nio/channels/spi/AbstractSelector.java
libjava/java/nio/channels/spi/SelectorProvider.java

index 54c9e04..034d8ae 100644 (file)
@@ -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 3e3956b..740fdbc 100644 (file)
@@ -37,11 +37,11 @@ exception statement from your version. */
 
 package java.nio.channels;
 
-import java.io.*;
-
-
 public class AlreadyConnectedException extends IllegalStateException
 {
+  /**
+   * Creates the exception
+   */
   public AlreadyConnectedException()
   {
   }
index 9c3c6cd..22f3d15 100644 (file)
@@ -40,40 +40,82 @@ package java.nio.channels;
 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 7b3a50e..2bc5cc4 100644 (file)
@@ -40,50 +40,99 @@ package java.nio.channels;
 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;
   
-  public abstract  int validOps();  
+  /**
+   * Returns a set of valid operations on this channel.
+   */
+  public abstract int validOps();
 }
index 6835d1d..8d06a30 100644 (file)
@@ -37,6 +37,10 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
 public abstract class SelectionKey
 {
   public static final int OP_ACCEPT  = 1<<0;
@@ -45,76 +49,116 @@ public abstract class SelectionKey
   public static final int OP_WRITE   = 1<<3;
     
   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(); 
-  
-  public abstract SelectableChannel channel();
-  
   /**
-   * @exception CancelledKeyException FIXME
+   * Requests that the registration of this key's channel with
+   * its selector be cancelled.
    */
-  public abstract int interestOps();
+  public abstract void cancel (); 
+  /**
+   * return the channel attached to the key.
+   */
+  public abstract SelectableChannel channel ();
   
   /**
-   * @exception CancelledKeyException FIXME
-   * @exception IllegalArgumentException FIXME
+   * Returns the key's interest set.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
    */
-  public abstract SelectionKey interestOps(int ops);
+  public abstract int interestOps ();
   
-  public abstract boolean isValid();
+  /**
+   * 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);
  
   /**
-   * @exception CancelledKeyException FIXME
+   * Tells whether or not this key is valid.
    */
-  public abstract int readyOps();
+  public abstract boolean isValid ();
+  /**
+   * Retrieves this key's ready-operation set.
+   * 
+   * @exception CancelledKeyException If this key has been cancelled
+   */
+  public abstract int readyOps ();
   
-  public abstract Selector selector();
+  /**
+   * Returns the selector for which this key was created.
+   */
+  public abstract Selector selector ();
 }
index 715bc7f..a712807 100644 (file)
@@ -37,60 +37,97 @@ exception statement from your version. */
 
 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 boolean isOpen();
+  public abstract void close () throws IOException;
   
   /**
-   * @exception ClosedSelectorException FIXME
+   * Tells whether the selector is open or not.
    */
-  public abstract Set keys();
+  public abstract boolean isOpen ();
   
-  public abstract SelectorProvider provider();
+  /**
+   * Returns this selector's key set.
+   * 
+   * @exception ClosedSelectorException If this selector is closed.
+   */
+  public abstract Set keys ();
+  /**
+   * 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 235b995..855087b 100644 (file)
@@ -41,47 +41,64 @@ import java.io.IOException;
 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 e14e3b3..01ea4f3 100644 (file)
@@ -39,28 +39,37 @@ package java.nio.channels.spi;
 
 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);
-      }
+      selector ().selectedKeys ().add (this);
     
     ok = false;
   }
 
+  /**
+   * Tells whether this key is valid or not.
+   */
   public final boolean isValid ()
   {
     return ok;
   }
 }
-
index 033a8d7..fc0aeca 100644 (file)
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels.spi;
 
+import java.io.IOException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.util.List;
@@ -44,57 +45,70 @@ import java.util.Set;
 
 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;
   }
-    
+
   protected final Set cancelledKeys()
   {
     return null;
   }
-  
+
   /**
-   * @exception IOException If an error occurs
+   * Closes the channel.
    */
-  protected abstract void implCloseSelector(); 
-  
-  protected abstract SelectionKey register(AbstractSelectableChannel ch, int ops, Object att);   
+  protected abstract void implCloseSelector () throws IOException;
+
+  protected abstract SelectionKey register (AbstractSelectableChannel ch,
+                                            int ops, Object att);   
 }
index 93ea537..06017f7 100644 (file)
@@ -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 @@ exception statement from your version. */
 
 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 @@ public abstract class SelectorProvider
   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();
-
-  public abstract  Pipe openPipe();
   
-  public abstract  AbstractSelector openSelector();
+  /**
+   * Opens a datagram channel.
+   */
+  public abstract DatagramChannel openDatagramChannel ();
+  
+  /**
+   * Opens a pipe.
+   */
+  public abstract Pipe openPipe ();
+  
+  /**
+   * Opens a selector.
+   */
+  public abstract AbstractSelector openSelector ();
   
-  public abstract  ServerSocketChannel openServerSocketChannel();
+  /**
+   * Opens a server socket channel.
+   */
+  public abstract ServerSocketChannel openServerSocketChannel ();
   
-  public abstract  SocketChannel openSocketChannel();
-   
   /**
-   * Returns the global <code>SelectorProvider</code> object
+   * Opens a socket channel.
    */
-  public static SelectorProvider provider()
+  public abstract SocketChannel openSocketChannel ();
+    
+  /**
+   * Returns the system-wide default selector provider for this invocation
+   * of the Java virtual machine.
+   */
+  public static SelectorProvider provider ()
   {
+/*    if (pr == null) */
+/*      pr = new SelectorProviderImpl (); */
+    
     return pr;
   }
 }