]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Buffer.java, [...]: Fixed javadocs and jalopied all over java.nio.
authorMichael Koch <konqueror@gmx.de>
Tue, 20 Apr 2004 15:27:38 +0000 (15:27 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Tue, 20 Apr 2004 15:27:38 +0000 (15:27 +0000)
2004-04-20  Michael Koch  <konqueror@gmx.de>

* java/nio/Buffer.java,
java/nio/channels/AlreadyConnectedException.java,
java/nio/channels/AsynchronousCloseException.java,
java/nio/channels/ByteChannel.java,
java/nio/channels/CancelledKeyException.java,
java/nio/channels/Channel.java,
java/nio/channels/Channels.java,
java/nio/channels/ClosedByInterruptException.java,
java/nio/channels/ClosedChannelException.java,
java/nio/channels/ClosedSelectorException.java,
java/nio/channels/ConnectionPendingException.java,
java/nio/channels/DatagramChannel.java,
java/nio/channels/FileChannel.java,
java/nio/channels/FileLock.java,
java/nio/channels/FileLockInterruptionException.java,
java/nio/channels/GatheringByteChannel.java,
java/nio/channels/IllegalBlockingModeException.java,
java/nio/channels/IllegalSelectorException.java,
java/nio/channels/InterruptibleChannel.java,
java/nio/channels/NoConnectionPendingException.java,
java/nio/channels/NonReadableChannelException.java,
java/nio/channels/NonWritableChannelException.java,
java/nio/channels/NotYetBoundException.java,
java/nio/channels/NotYetConnectedException.java,
java/nio/channels/OverlappingFileLockException.java,
java/nio/channels/Pipe.java,
java/nio/channels/ReadableByteChannel.java,
java/nio/channels/ScatteringByteChannel.java,
java/nio/channels/SelectableChannel.java,
java/nio/channels/SelectionKey.java,
java/nio/channels/Selector.java,
java/nio/channels/ServerSocketChannel.java,
java/nio/channels/SocketChannel.java,
java/nio/channels/UnresolvedAddressException.java,
java/nio/channels/UnsupportedAddressTypeException.java,
java/nio/channels/WritableByteChannel.java,
java/nio/channels/spi/AbstractInterruptibleChannel.java,
java/nio/channels/spi/AbstractSelectableChannel.java,
java/nio/channels/spi/AbstractSelectionKey.java,
java/nio/channels/spi/AbstractSelector.java,
java/nio/channels/spi/SelectorProvider.java,
java/nio/charset/spi/CharsetProvider.java:
Fixed javadocs and jalopied all over java.nio.

From-SVN: r80909

43 files changed:
libjava/ChangeLog
libjava/java/nio/Buffer.java
libjava/java/nio/channels/AlreadyConnectedException.java
libjava/java/nio/channels/AsynchronousCloseException.java
libjava/java/nio/channels/ByteChannel.java
libjava/java/nio/channels/CancelledKeyException.java
libjava/java/nio/channels/Channel.java
libjava/java/nio/channels/Channels.java
libjava/java/nio/channels/ClosedByInterruptException.java
libjava/java/nio/channels/ClosedChannelException.java
libjava/java/nio/channels/ClosedSelectorException.java
libjava/java/nio/channels/ConnectionPendingException.java
libjava/java/nio/channels/DatagramChannel.java
libjava/java/nio/channels/FileChannel.java
libjava/java/nio/channels/FileLock.java
libjava/java/nio/channels/FileLockInterruptionException.java
libjava/java/nio/channels/GatheringByteChannel.java
libjava/java/nio/channels/IllegalBlockingModeException.java
libjava/java/nio/channels/IllegalSelectorException.java
libjava/java/nio/channels/InterruptibleChannel.java
libjava/java/nio/channels/NoConnectionPendingException.java
libjava/java/nio/channels/NonReadableChannelException.java
libjava/java/nio/channels/NonWritableChannelException.java
libjava/java/nio/channels/NotYetBoundException.java
libjava/java/nio/channels/NotYetConnectedException.java
libjava/java/nio/channels/OverlappingFileLockException.java
libjava/java/nio/channels/Pipe.java
libjava/java/nio/channels/ReadableByteChannel.java
libjava/java/nio/channels/ScatteringByteChannel.java
libjava/java/nio/channels/SelectableChannel.java
libjava/java/nio/channels/SelectionKey.java
libjava/java/nio/channels/Selector.java
libjava/java/nio/channels/ServerSocketChannel.java
libjava/java/nio/channels/SocketChannel.java
libjava/java/nio/channels/UnresolvedAddressException.java
libjava/java/nio/channels/UnsupportedAddressTypeException.java
libjava/java/nio/channels/WritableByteChannel.java
libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
libjava/java/nio/channels/spi/AbstractSelectableChannel.java
libjava/java/nio/channels/spi/AbstractSelectionKey.java
libjava/java/nio/channels/spi/AbstractSelector.java
libjava/java/nio/channels/spi/SelectorProvider.java
libjava/java/nio/charset/spi/CharsetProvider.java

index b57c3fbbd79d3ad25f62a7af2ffc5a77ab74592a..d931b32ba1132e670ff1d64f6e77fd25ef48f0a4 100644 (file)
@@ -1,3 +1,49 @@
+2004-04-20  Michael Koch  <konqueror@gmx.de>
+
+       * java/nio/Buffer.java,
+       java/nio/channels/AlreadyConnectedException.java,
+       java/nio/channels/AsynchronousCloseException.java,
+       java/nio/channels/ByteChannel.java,
+       java/nio/channels/CancelledKeyException.java,
+       java/nio/channels/Channel.java,
+       java/nio/channels/Channels.java,
+       java/nio/channels/ClosedByInterruptException.java,
+       java/nio/channels/ClosedChannelException.java,
+       java/nio/channels/ClosedSelectorException.java,
+       java/nio/channels/ConnectionPendingException.java,
+       java/nio/channels/DatagramChannel.java,
+       java/nio/channels/FileChannel.java,
+       java/nio/channels/FileLock.java,
+       java/nio/channels/FileLockInterruptionException.java,
+       java/nio/channels/GatheringByteChannel.java,
+       java/nio/channels/IllegalBlockingModeException.java,
+       java/nio/channels/IllegalSelectorException.java,
+       java/nio/channels/InterruptibleChannel.java,
+       java/nio/channels/NoConnectionPendingException.java,
+       java/nio/channels/NonReadableChannelException.java,
+       java/nio/channels/NonWritableChannelException.java,
+       java/nio/channels/NotYetBoundException.java,
+       java/nio/channels/NotYetConnectedException.java,
+       java/nio/channels/OverlappingFileLockException.java,
+       java/nio/channels/Pipe.java,
+       java/nio/channels/ReadableByteChannel.java,
+       java/nio/channels/ScatteringByteChannel.java,
+       java/nio/channels/SelectableChannel.java,
+       java/nio/channels/SelectionKey.java,
+       java/nio/channels/Selector.java,
+       java/nio/channels/ServerSocketChannel.java,
+       java/nio/channels/SocketChannel.java,
+       java/nio/channels/UnresolvedAddressException.java,
+       java/nio/channels/UnsupportedAddressTypeException.java,
+       java/nio/channels/WritableByteChannel.java,
+       java/nio/channels/spi/AbstractInterruptibleChannel.java,
+       java/nio/channels/spi/AbstractSelectableChannel.java,
+       java/nio/channels/spi/AbstractSelectionKey.java,
+       java/nio/channels/spi/AbstractSelector.java,
+       java/nio/channels/spi/SelectorProvider.java,
+       java/nio/charset/spi/CharsetProvider.java:
+       Fixed javadocs and jalopied all over java.nio.
+
 2004-04-20  Michael Koch  <konqueror@gmx.de>
 
        * java/nio/ByteBufferImpl.java,
index 444d3d1c3ae0a8a35b1f98a1b9883d349cbe4996..c24259f71ec2a86ea7b054447d5f53fceded22d8 100644 (file)
@@ -45,10 +45,11 @@ public abstract class Buffer
   int pos = 0;
   int mark = -1;
 
-  // Creates a new Buffer.
-  //
-  // Should be package private.
-  //
+  /**
+   * Creates a new Buffer.
+   *
+   * Should be package private.
+   */
   Buffer (int capacity, int limit, int position, int mark)
   {
     if (capacity < 0)
@@ -69,6 +70,8 @@ public abstract class Buffer
   
   /**
    * Retrieves the capacity of the buffer.
+   *
+   * @return the capacity of the buffer
    */
   public final int capacity ()
   {
@@ -77,6 +80,8 @@ public abstract class Buffer
 
   /**
    * Clears the buffer.
+   *
+   * @return this buffer
    */
   public final Buffer clear ()
   {
@@ -88,6 +93,8 @@ public abstract class Buffer
     
   /**
    * Flips the buffer.
+   *
+   * @return this buffer
    */
   public final Buffer flip ()
   {
@@ -99,6 +106,9 @@ public abstract class Buffer
     
   /**
    * Tells whether the buffer has remaining data to read or not.
+   *
+   * @return true if the buffer contains remaining data to read,
+   * false otherwise
    */
   public final boolean hasRemaining ()
   {
@@ -107,11 +117,15 @@ public abstract class Buffer
 
   /**
    * Tells whether this buffer is read only or not.
+   *
+   * @return true if the buffer is read only, false otherwise
    */
   public abstract boolean isReadOnly ();
 
   /**
    * Retrieves the current limit of the buffer.
+   *
+   * @return the limit of the buffer
    */
   public final int limit ()
   {
@@ -124,6 +138,8 @@ public abstract class Buffer
    * @param newLimit The new limit value; must be non-negative and no larger
    * than this buffer's capacity.
    *
+   * @return this buffer
+   *
    * @exception IllegalArgumentException If the preconditions on newLimit
    * do not hold.
    */
@@ -144,6 +160,8 @@ public abstract class Buffer
 
   /**
    * Sets this buffer's mark at its position.
+   *
+   * @return this buffer
    */
   public final Buffer mark ()
   {
@@ -153,6 +171,8 @@ public abstract class Buffer
 
   /**
    * Retrieves the current position of this buffer.
+   *
+   * @return the current position of this buffer
    */
   public final int position ()
   {
@@ -165,7 +185,9 @@ public abstract class Buffer
    * 
    * @param newPosition The new position value; must be non-negative and no
    * larger than the current limit.
-   * 
+   *
+   * @return this buffer
+   *
    * @exception IllegalArgumentException If the preconditions on newPosition
    * do not hold
    */
@@ -183,6 +205,8 @@ public abstract class Buffer
 
   /**
    * Returns the number of elements between the current position and the limit.
+   *
+   * @return the number of remaining elements
    */
   public final int remaining()
   {
@@ -191,7 +215,9 @@ public abstract class Buffer
 
   /**
    * Resets this buffer's position to the previously-marked position.
-   * 
+   *
+   * @return this buffer
+   *
    * @exception InvalidMarkException If the mark has not been set.
    */
   public final Buffer reset()
@@ -206,6 +232,8 @@ public abstract class Buffer
   /**
    * Rewinds this buffer. The position is set to zero and the mark
    * is discarded.
+   *
+   * @this buffer
    */
   public final Buffer rewind()
   {
index 740fdbc0ddd9692fc3edeb106aeef5da5ac3191d..775d2894da2f73f4ae1aba8f5c217c14ce92ca68 100644 (file)
@@ -1,4 +1,4 @@
-/* AlreadyConnectedException.java -- 
+/* AlreadyConnectedException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
index ec4bbc7fd47bcc0f33d0bb4f45122e7f9a47889d..d6cfd48ee307f961cf0491f53a72aed142937a78 100644 (file)
@@ -1,4 +1,4 @@
-/* AsynchronousCloseException.java -- 
+/* AsynchronousCloseException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index f4958be2bf7a637df2d54d882ce523425b03312d..75dd69f7279fe1ba861abe7e2bd45e8741fca183 100644 (file)
@@ -1,4 +1,4 @@
-/* ByteChannel.java -- 
+/* ByteChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,7 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
-public interface ByteChannel
-  extends ReadableByteChannel, WritableByteChannel
+public interface ByteChannel extends ReadableByteChannel,
+                                     WritableByteChannel
 {
 }
index cf3c5cc352c67fbf68eaf658ca48add5a5bfc6e2..00fb04c43c12830cac99498a85dd514044734b2c 100644 (file)
@@ -1,4 +1,4 @@
-/* CancelledKeyException.java -- 
+/* CancelledKeyException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 86df85edb1b36426a92b4f3b0766380deece45bb..fabe183be1fdba6314d62d5afc4ab3b78866b55a 100644 (file)
@@ -1,4 +1,4 @@
-/* Channel.java -- 
+/* Channel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ package java.nio.channels;
 
 import java.io.IOException;
 
+
 public interface Channel
 {
   /**
index 896e1734d8051431083046805469ab3027172e83..20ef50d06782d2606e5782e3e609608e767bb966 100644 (file)
@@ -1,4 +1,4 @@
-/* Channels.java -- 
+/* Channels.java --
    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -42,20 +42,21 @@ import gnu.java.nio.ChannelOutputStream;
 import gnu.java.nio.InputStreamChannel;
 import gnu.java.nio.OutputStreamChannel;
 import gnu.java.nio.channels.FileChannelImpl;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 
+
 /**
  * @since 1.4
  */
-public final class Channels 
+public final class Channels
 {
   /**
    * Constructs a stream that reads bytes from the given channel.
@@ -70,7 +71,7 @@ public final class Channels
   /**
    * Constructs a stream that writes bytes to the given channel.
    */
-  public static OutputStream newOutputStream(WritableByteChannel ch) 
+  public static OutputStream newOutputStream(WritableByteChannel ch)
   {
     if (ch instanceof FileChannelImpl)
       return newOutputStream((FileChannelImpl) ch);
@@ -78,8 +79,9 @@ public final class Channels
   }
 
   static native FileInputStream newInputStream(FileChannelImpl ch);
+
   static native FileOutputStream newOutputStream(FileChannelImpl ch);
-  
+
   /**
    * Constructs a channel that reads bytes from the given stream.
    */
@@ -93,15 +95,15 @@ public final class Channels
    */
   public static WritableByteChannel newChannel(OutputStream out)
   {
-    return new OutputStreamChannel (out);
+    return new OutputStreamChannel(out);
   }
 
   /**
    * Constructs a reader that decodes bytes from the given channel using the
    * given decoder.
    */
-  public static Reader newReader (ReadableByteChannel ch, CharsetDecoder dec,
-                                  int minBufferCap)
+  public static Reader newReader(ReadableByteChannel ch, CharsetDecoder dec,
+                                 int minBufferCap)
   {
     throw new Error ("not implemented");
   }
@@ -113,17 +115,17 @@ public final class Channels
    * @exception UnsupportedCharsetException If no support for the named charset
    * is available in this instance of the Java virtual machine.
    */
-  public static Reader newReader (ReadableByteChannel ch, String csName)
+  public static Reader newReader(ReadableByteChannel ch, String csName)
   {
-    return newReader (ch, Charset.forName (csName).newDecoder (), -1);
+    return newReader(ch, Charset.forName(csName).newDecoder(), -1);
   }
 
   /**
    * Constructs a writer that encodes characters using the given encoder and
    * writes the resulting bytes to the given channel.
    */
-  public static Writer newWriter (WritableByteChannel ch, CharsetEncoder enc,
-                                  int minBufferCap)
+  public static Writer newWriter(WritableByteChannel ch, CharsetEncoder enc,
+                                 int minBufferCap)
   {
     throw new Error ("not implemented");
   }
@@ -135,9 +137,8 @@ public final class Channels
    * @exception UnsupportedCharsetException If no support for the named charset
    * is available in this instance of the Java virtual machine.
    */
-  public static Writer newWriter (WritableByteChannel ch,
-                                  String csName)
+  public static Writer newWriter(WritableByteChannel ch, String csName)
   {
-    return newWriter (ch, Charset.forName (csName).newEncoder (), -1);
+    return newWriter(ch, Charset.forName(csName).newEncoder(), -1);
   }
 }
index b99e016f17dfd12238a28149d81bf48330f8b5de..7a9e64c4f71a26af1b7b88417b87099dbcf790cd 100644 (file)
@@ -1,4 +1,4 @@
-/* ClosedByInterruptException.java -- 
+/* ClosedByInterruptException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 353a820264747831be68cdfadfbb9d18798ed446..876ad062f1f80625f57c660b4745841dfad61b97 100644 (file)
@@ -1,4 +1,4 @@
-/* ClosedChannelException.java -- 
+/* ClosedChannelException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ package java.nio.channels;
 
 import java.io.IOException;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 98a9d505ded801957281532e8cb43d3f6da7d5cc..ae5421d053d15875e4909933725d300031e5601c 100644 (file)
@@ -1,4 +1,4 @@
-/* ClosedSelectorException.java -- 
+/* ClosedSelectorException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 876179c01b4aa049c07e3241d06579f49ef3cf10..c224058f0f7af5aa9f9c4bce1b0571c9a920f41e 100644 (file)
@@ -1,4 +1,4 @@
-/* ConnectionPendingException.java -- 
+/* ConnectionPendingException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 4a7ac9825f74346a23396b070d1c4b55ea8312dc..9760b77123e427f9b94e08248c1a67ad15475c28 100644 (file)
@@ -1,4 +1,4 @@
-/* DatagramChannel.java -- 
+/* DatagramChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -44,19 +44,19 @@ import java.nio.ByteBuffer;
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.nio.channels.spi.SelectorProvider;
 
+
 /**
  * @since 1.4
  */
-public abstract class DatagramChannel
-  extends AbstractSelectableChannel
+public abstract class DatagramChannel extends AbstractSelectableChannel
   implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
 {
   /**
    * Initializes the channel.
    */
-  protected DatagramChannel (SelectorProvider provider)
+  protected DatagramChannel(SelectorProvider provider)
   {
-    super (provider);
+    super(provider);
   }
 
   /**
@@ -64,40 +64,40 @@ public abstract class DatagramChannel
    *
    * @exception IOException If an error occurs
    */
-  public static DatagramChannel open () throws IOException
+  public static DatagramChannel open() throws IOException
   {
-    return SelectorProvider.provider ().openDatagramChannel ();
+    return SelectorProvider.provider().openDatagramChannel();
   }
-  
+
   /**
    * Reads data from this channel.
    */
-  public final long read (ByteBuffer[] dsts) throws IOException
+  public final long read(ByteBuffer[] dsts) throws IOException
   {
     long b = 0;
-    
+
     for (int i = 0; i < dsts.length; i++)
-      b += read (dsts[i]);
-    
+      b += read(dsts[i]);
+
     return b;
   }
-  
+
   /**
    * Writes data to this channel.
    *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public final long write (ByteBuffer[] srcs) throws IOException
+  public final long write(ByteBuffer[] srcs) throws IOException
   {
     long b = 0;
-    
-    for (int i = 0;i < srcs.length; i++)
-      b += write (srcs[i]);
-    
+
+    for (int i = 0; i < srcs.length; i++)
+      b += write(srcs[i]);
+
     return b;
   }
-    
+
   /**
    * Connects this channel's socket.
    *
@@ -111,7 +111,7 @@ public abstract class DatagramChannel
    * @exception SecurityException If a security manager has been installed and
    * it does not permit datagrams to be sent to the given address.
    */
-  public abstract DatagramChannel connect (SocketAddress remote)
+  public abstract DatagramChannel connect(SocketAddress remote)
     throws IOException;
 
   /**
@@ -119,7 +119,7 @@ public abstract class DatagramChannel
    *
    * @exception IOException If an error occurs
    */
-  public abstract DatagramChannel disconnect () throws IOException;
+  public abstract DatagramChannel disconnect() throws IOException;
 
   /**
    * Tells whether or not this channel's socket is connected.
@@ -127,22 +127,22 @@ public abstract class DatagramChannel
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract boolean isConnected ();
-  
+  public abstract boolean isConnected();
+
   /**
    * Reads data from this channel.
    */
-  public abstract int read (ByteBuffer dst) throws IOException;
-  
+  public abstract int read(ByteBuffer dst) throws IOException;
+
   /**
    * Reads data from this channel.
    *
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract long read (ByteBuffer[] dsts, int offset, int length)
+  public abstract long read(ByteBuffer[] dsts, int offset, int length)
     throws IOException;
+
   /**
    * Receives a datagram via this channel.
    *
@@ -156,8 +156,9 @@ public abstract class DatagramChannel
    * @exception SecurityException If a security manager has been installed and
    * it does not permit datagrams to be sent to the given address.
    */
-  public abstract SocketAddress receive (ByteBuffer dst) throws IOException;
+  public abstract SocketAddress receive(ByteBuffer dst)
+    throws IOException;
+
   /**
    * Sends a datagram via this channel.
    *
@@ -171,29 +172,29 @@ public abstract class DatagramChannel
    * @exception SecurityException If a security manager has been installed and
    * it does not permit datagrams to be sent to the given address.
    */
-  public abstract int send (ByteBuffer src, SocketAddress target)
+  public abstract int send(ByteBuffer src, SocketAddress target)
     throws IOException;
+
   /**
    * Retrieves the channel's socket.
    */
-  public abstract DatagramSocket socket ();
-  
+  public abstract DatagramSocket socket();
+
   /**
    * Writes data to this channel.
    *
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract int write (ByteBuffer src) throws IOException;
-  
+  public abstract int write(ByteBuffer src) throws IOException;
+
   /**
    * Writes data to this channel.
    *
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract long write (ByteBuffer[] srcs, int offset, int length)
+  public abstract long write(ByteBuffer[] srcs, int offset, int length)
     throws IOException;
 
   /**
@@ -202,8 +203,8 @@ public abstract class DatagramChannel
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public final int validOps ()
+  public final int validOps()
   {
     return SelectionKey.OP_READ | SelectionKey.OP_WRITE;
-  }    
+  }
 }
index 6604e99744e3d0d6f87280c329f24ea4bc95762f..7e1a33173eb54d4eed57803a1080ce287ee34026 100644 (file)
@@ -1,4 +1,4 @@
-/* FileChannel.java -- 
+/* FileChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -42,6 +42,7 @@ import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.spi.AbstractInterruptibleChannel;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
@@ -52,10 +53,9 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
   public static class MapMode
   {
     int m;
-
-    public static final MapMode READ_ONLY  = new MapMode(0);
+    public static final MapMode READ_ONLY = new MapMode(0);
     public static final MapMode READ_WRITE = new MapMode(1);
-    public static final MapMode PRIVATE    = new MapMode(2);
+    public static final MapMode PRIVATE = new MapMode(2);
 
     /**
      * Initializes the MapMode.
@@ -68,12 +68,12 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
     /**
      * Returns a string representation of the <code>MapMode</code> object.
      */
-    public String toString() 
+    public String toString()
     {
       if (this == READ_ONLY)
-        return "READ_ONLY";
+       return "READ_ONLY";
       else if (this == READ_WRITE)
-        return "READ_WRITE";
+       return "READ_WRITE";
 
       return "PRIVATE";
     }
@@ -82,7 +82,7 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
   /**
    * Initializes the channel.
    */
-  protected FileChannel ()
+  protected FileChannel()
   {
   }
 
@@ -102,34 +102,32 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
 
   /**
    * Return the size of the file thus far
-   * 
+   *
    * @exception ClosedChannelException If this channel is closed.
    */
   public abstract long size() throws IOException;
-  
+
   /**
    * Writes data to the channel.
    *
    * @exception IOException If an I/O error occurs.
    */
-  public final long write (ByteBuffer[] srcs) throws IOException
+  public final long write(ByteBuffer[] srcs) throws IOException
   {
     long result = 0;
-    
+
     for (int i = 0; i < srcs.length; i++)
-      {
-        result += write (srcs[i]);
-      }
-    
+      result += write(srcs[i]);
+
     return result;
   }
-  
+
   /**
    * Writes data to the channel.
    *
    * @exception IOException If an I/O error occurs.
    */
-  public abstract int write (ByteBuffer src) throws IOException;
+  public abstract int write(ByteBuffer src) throws IOException;
 
   /**
    * Writes data to the channel.
@@ -145,7 +143,8 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception NonWritableChannelException If this channel was not opened for
    * writing.
    */
-  public abstract int write (ByteBuffer srcs, long position) throws IOException;
+  public abstract int write(ByteBuffer srcs, long position)
+    throws IOException;
 
   /**
    * Writes data to the channel.
@@ -154,13 +153,13 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    */
   public abstract long write(ByteBuffer[] srcs, int offset, int length)
     throws IOException;
-  
+
   /**
    * Reads data from the channel.
    *
    * @exception IOException If an I/O error occurs.
    */
-  public abstract long read (ByteBuffer[] dsts, int offset, int length)
+  public abstract long read(ByteBuffer[] dsts, int offset, int length)
     throws IOException;
 
   /**
@@ -168,14 +167,12 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    *
    * @exception IOException If an I/O error occurs.
    */
-  public final long read (ByteBuffer[] dsts) throws IOException
+  public final long read(ByteBuffer[] dsts) throws IOException
   {
     long result = 0;
-    
+
     for (int i = 0; i < dsts.length; i++)
-      {
-        read (dsts [i]);
-      }
+      read(dsts[i]);
 
     return result;
   }
@@ -186,7 +183,7 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception IOException If an I/O error occurs.
    */
   public abstract int read(ByteBuffer dst) throws IOException;
-  
+
   /**
    * Reads data from the channel.
    *
@@ -201,8 +198,9 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception NonReadableChannelException If this channel was not opened for
    * reading.
    */
-  public abstract int read(ByteBuffer dst, long position) throws IOException;
-  
+  public abstract int read(ByteBuffer dst, long position)
+    throws IOException;
+
   /**
    * Closes the channel.
    *
@@ -238,9 +236,9 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * another thread is already blocked in this method and is attempting to lock
    * an overlapping region.
    */
-  public final FileLock lock () throws IOException
+  public final FileLock lock() throws IOException
   {
-    return lock (0, Long.MAX_VALUE, false);
+    return lock(0, Long.MAX_VALUE, false);
   }
 
   /**
@@ -263,7 +261,7 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception NonWritableChannelException If shared is false and this channel
    * was not opened for writing.
    */
-  public abstract FileLock lock (long position, long size, boolean shared)
+  public abstract FileLock lock(long position, long size, boolean shared)
     throws IOException;
 
   /**
@@ -276,9 +274,9 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * another thread is already blocked in this method and is attempting to lock
    * an overlapping region.
    */
-  public final FileLock tryLock () throws IOException
+  public final FileLock tryLock() throws IOException
   {
-    return tryLock (0, Long.MAX_VALUE, false);
+    return tryLock(0, Long.MAX_VALUE, false);
   }
 
   /**
@@ -293,7 +291,7 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * another thread is already blocked in this method and is attempting to lock
    * an overlapping region.
    */
-  public abstract FileLock tryLock (long position, long size, boolean shared)
+  public abstract FileLock tryLock(long position, long size, boolean shared)
     throws IOException;
 
   /**
@@ -302,7 +300,7 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception ClosedChannelException If this channel is closed.
    * @exception IOException If an I/O error occurs.
    */
-  public abstract long position () throws IOException;
+  public abstract long position() throws IOException;
 
   /**
    * Sets the position of the channel on the assoziated file.
@@ -311,7 +309,8 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception IllegalArgumentException If newPosition is negative.
    * @exception IOException If an I/O error occurs.
    */
-  public abstract FileChannel position (long newPosition) throws IOException;
+  public abstract FileChannel position(long newPosition)
+    throws IOException;
 
   /**
    * Transfers bytes from this channel's file to the given writable byte
@@ -331,8 +330,8 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception NonWritableChannelException If the target channel was not
    * opened for writing.
    */
-  public abstract long transferTo (long position, long count,
-                                   WritableByteChannel target)
+  public abstract long transferTo(long position, long count,
+                                  WritableByteChannel target)
     throws IOException;
 
   /**
@@ -352,8 +351,8 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception NonWritableChannelException If this channel was not opened for
    * writing.
    */
-  public abstract long transferFrom (ReadableByteChannel src, long position,
-                                     long count) throws IOException;
+  public abstract long transferFrom(ReadableByteChannel src, long position,
+                                    long count) throws IOException;
 
   /**
    * Truncates the channel's file at <code>size</code>.
@@ -364,5 +363,5 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
    * @exception NonWritableChannelException If this channel was not opened for
    * writing.
    */
-  public abstract FileChannel truncate (long size) throws IOException;
+  public abstract FileChannel truncate(long size) throws IOException;
 }
index 866ed3997d188de8bf10cdb7e68a1e1324742d0e..629f5ef79ec8aa513c934d8df729f13ad974236e 100644 (file)
@@ -1,4 +1,4 @@
-/* FileLock.java -- 
+/* FileLock.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ package java.nio.channels;
 
 import java.io.IOException;
 
+
 /**
  * @since 1.4
  */
@@ -48,42 +49,41 @@ public abstract class FileLock
   long position;
   long size;
   boolean shared;
-  
+
   /**
    * Initializes the file lock.
    *
    * @exception IllegalArgumentException If the preconditions on the parameters do not hold
    */
-  protected FileLock (FileChannel channel, long position, long size,
-                      boolean shared)
+  protected FileLock(FileChannel channel, long position, long size,
+                     boolean shared)
   {
-    if (position < 0 ||
-        size < 0)
-      throw new IllegalArgumentException ();
+    if (position < 0 || size < 0)
+      throw new IllegalArgumentException();
 
     this.channel = channel;
     this.position = position;
     this.size = size;
     this.shared = shared;
   }
+
   /**
    * Tells whether or not this lock is valid.
    */
   public abstract boolean isValid();
+
   /**
    * Releases this lock.
    *
    * @exception IOException If an error occurs
    * @exception ClosedChannelException If the locked channel is no longer open.
    */
-  public abstract void release () throws IOException;
-  
+  public abstract void release() throws IOException;
+
   /**
    * Returns the file channel upon whose file this lock is held.
    */
-  public final FileChannel channel ()
+  public final FileChannel channel()
   {
     return channel;
   }
@@ -91,15 +91,15 @@ public abstract class FileLock
   /**
    * Tells whether this lock is shared.
    */
-  public final boolean isShared ()
+  public final boolean isShared()
   {
     return shared;
-  }    
+  }
 
   /**
    * Tells whether or not this lock overlaps the given lock range.
    */
-  public final boolean overlaps (long position, long size)
+  public final boolean overlaps(long position, long size)
   {
     if (position > this.position + this.size)
       return false;
@@ -114,15 +114,15 @@ public abstract class FileLock
    * Returns the position within the file of the first byte of the
    * locked region.
    */
-  public final long position ()
+  public final long position()
   {
     return position;
   }
-    
+
   /**
    * Returns the size of the locked region in bytes.
    */
-  public final long size ()
+  public final long size()
   {
     return size;
   }
@@ -130,7 +130,7 @@ public abstract class FileLock
   /**
    * Returns a string describing the range, type, and validity of this lock.
    */
-  public final String toString ()
+  public final String toString()
   {
     return "file-lock:pos=" + position + "size=" + size;
   }
index 563b0a08fe7cd26fb879544d0399b85d14aca078..5caff1707432135e16d2afdffc207501b060f753 100644 (file)
@@ -1,4 +1,4 @@
-/* FileLockInterruptionException.java -- 
+/* FileLockInterruptionException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ package java.nio.channels;
 
 import java.io.IOException;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 1528e56175c14f5c46287e22938d914526fdcc9f..80f50c875fe7f3bc7d9d0176b1a948be4a2257eb 100644 (file)
@@ -1,4 +1,4 @@
-/* GatheringByteChannel.java -- 
+/* GatheringByteChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,11 +37,11 @@ exception statement from your version. */
 
 package java.nio.channels;
 
-import java.nio.ByteBuffer;
 import java.io.IOException;
+import java.nio.ByteBuffer;
 
-public interface GatheringByteChannel
-  extends WritableByteChannel
+
+public interface GatheringByteChannel extends WritableByteChannel
 {
   /**
    * Writes a sequence of bytes to this channel from a subsequence of
@@ -59,9 +59,9 @@ public interface GatheringByteChannel
    * @exception NonWritableChannelException If this channel was not opened for
    * writing
    */
-  long write (ByteBuffer[] srcs, int offset, int length)
+  long write(ByteBuffer[] srcs, int offset, int length)
     throws IOException;
-  
+
   /**
    * Writes a sequence of bytes to this channel from the given buffers
    *
@@ -75,5 +75,5 @@ public interface GatheringByteChannel
    * @exception NonWritableChannelException If this channel was not opened for
    * writing
    */
-  long write (ByteBuffer[] srcs) throws IOException;
+  long write(ByteBuffer[] srcs) throws IOException;
 }
index dca8110059b8224db3eb413f3ca9be25964ef420..5b70c1f5814763c14ccc9777f11fdb065ad66b46 100644 (file)
@@ -1,4 +1,4 @@
-/* IllegalBlockingModeException.java -- 
+/* IllegalBlockingModeException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch <konqueror@gmx.de>
  * @since 1.4
index 20465e56b1d32c91d0e1f7b1cd10dee273d0747e..d1421e45653cf653340b14776e020a3996e9b0f5 100644 (file)
@@ -1,4 +1,4 @@
-/* IllegalSelectorException.java -- 
+/* IllegalSelectorException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 0b55e7619a5ac231670207ff10cdbcd8fe93cc3f..ad4195efb0fa263d8fb6553a988938e8868ea20e 100644 (file)
@@ -1,4 +1,4 @@
-/* InterruptibleChannel.java -- 
+/* InterruptibleChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ package java.nio.channels;
 
 import java.io.IOException;
 
+
 public interface InterruptibleChannel extends Channel
 {
   /**
index f859cf6f651e1d2b8b5b5af3245b65eb42129651..4dbe7f96a8559ecb94be2c5b1b51466fa70cf844 100644 (file)
@@ -1,4 +1,4 @@
-/* NoConnectionPendingException.java -- 
+/* NoConnectionPendingException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index cb146bb5133876e6dfd55b8df46a94cba407bb1e..ff3bd4a9edf06756bc3ca93212dbcb131aa2be68 100644 (file)
@@ -1,4 +1,4 @@
-/* NonReadableChannelException.java -- 
+/* NonReadableChannelException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index a26af3537c29c48ede2545a8f33b4bf7156e3fd2..363041ba97a8b998095e9a52c4fac1bc5f72012d 100644 (file)
@@ -1,4 +1,4 @@
-/* NonWritableChannelException.java -- 
+/* NonWritableChannelException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 0367b35e90def379399cb28698cf5a495bf2d053..167d5b5be64cff4ed646a59fbb6f7b83ce88bd5e 100644 (file)
@@ -1,4 +1,4 @@
-/* NotYetBoundException.java -- 
+/* NotYetBoundException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 3c15369611b5b326508542fc94fdf19cb7beb57c..671ad1a421ded1e89ac346d33e3bbdddf905aedf 100644 (file)
@@ -1,4 +1,4 @@
-/* NotYetConnectedException.java -- 
+/* NotYetConnectedException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 2f856d3ea7303b6ce9203f5abdbc8e1cad532e93..d3435264dabb8bf3ad702bb4385bf336a96d3693 100644 (file)
@@ -1,4 +1,4 @@
-/* OverlappingFileLockException.java -- 
+/* OverlappingFileLockException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 939d7b52ad2671cd9ebe20e4b73ec828aadd4672..baee1fa563d1392a6f17e6756e8feea759072458 100644 (file)
@@ -1,4 +1,4 @@
-/* Pipe.java -- 
+/* Pipe.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -41,22 +41,22 @@ import java.io.IOException;
 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
+  public abstract static class SinkChannel extends AbstractSelectableChannel
     implements WritableByteChannel, GatheringByteChannel
   {
     /**
      * Initializes the channel.
      */
-    protected SinkChannel (SelectorProvider provider)
+    protected SinkChannel(SelectorProvider provider)
     {
-      super (provider);
+      super(provider);
     }
 
     /**
@@ -64,22 +64,21 @@ public abstract class Pipe
      *
      * The only valid operation on this channel is @see SelectionKey.OP_WRITE.
      */
-    public final int validOps ()
+    public final int validOps()
     {
       return SelectionKey.OP_WRITE;
     }
   }
 
-  public abstract static class SourceChannel
-    extends AbstractSelectableChannel
+  public abstract static class SourceChannel extends AbstractSelectableChannel
     implements ReadableByteChannel, ScatteringByteChannel
   {
     /**
      * Initializes the channel.
      */
-    protected SourceChannel (SelectorProvider provider)
+    protected SourceChannel(SelectorProvider provider)
     {
-      super (provider);
+      super(provider);
     }
 
     /**
@@ -87,7 +86,7 @@ public abstract class Pipe
      *
      * The only valid operation on this channel is @see SelectionKey.OP_READ.
      */
-    public final int validOps ()
+    public final int validOps()
     {
       return SelectionKey.OP_READ;
     }
@@ -102,12 +101,12 @@ public abstract class Pipe
 
   /**
    * Opens a pipe.
-   * 
+   *
    * @exception IOException If an error occurs
    */
   public static Pipe open() throws IOException
   {
-    return SelectorProvider.provider ().openPipe();
+    return SelectorProvider.provider().openPipe();
   }
 
   /**
@@ -118,5 +117,5 @@ public abstract class Pipe
   /**
    * Returns a pipe's source channel
    */
-  public abstract Pipe.SourceChannel source();   
+  public abstract Pipe.SourceChannel source();
 }
index f870e6bdfa829d633d917031e42ff4d53f79edea..fb39dcb582f80baf13a7b568314845aa1177063a 100644 (file)
@@ -1,5 +1,5 @@
-/* ReadableByteChannel.java -- 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* ReadableByteChannel.java --
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,11 +40,16 @@ package java.nio.channels;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
+
 public interface ReadableByteChannel extends Channel
 {
   /**
    * Reads a sequence of bytes from this channel into the given buffer
    *
+   * @param dst the buffer to put the read data into
+   *
+   * @return the numer of bytes read
+   *
    * @exception AsynchronousCloseException If another thread closes this
    * channel while the read operation is in progress
    * @exception ClosedByInterruptException If another thread interrupts the
@@ -55,5 +60,5 @@ public interface ReadableByteChannel extends Channel
    * @exception NonReadableChannelException If this channel was not opened for
    * reading
    */
-  int read (ByteBuffer dst) throws IOException;
+  int read(ByteBuffer dst) throws IOException;
 }
index bd8bb6cac4d769423e5e31a6a966c3008633d6ba..7c754065f97db73e81ec7e723d4664a64b97396e 100644 (file)
@@ -1,4 +1,4 @@
-/* ScatteringByteChannel.java -- 
+/* ScatteringByteChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,11 +37,11 @@ exception statement from your version. */
 
 package java.nio.channels;
 
-import java.nio.ByteBuffer;
 import java.io.IOException;
+import java.nio.ByteBuffer;
+
 
-public interface ScatteringByteChannel
-  extends ReadableByteChannel
+public interface ScatteringByteChannel extends ReadableByteChannel
 {
   /**
    * Reads a sequence of bytes from this channel into a subsequence of the
@@ -59,7 +59,7 @@ public interface ScatteringByteChannel
    * @exception NonReadableChannelException If this channel was not opened for
    * reading
    */
-  long read (ByteBuffer[] srcs, int offset, int length)
+  long read(ByteBuffer[] srcs, int offset, int length)
     throws IOException;
 
   /**
@@ -75,5 +75,5 @@ public interface ScatteringByteChannel
    * @exception NonReadableChannelException If this channel was not opened for
    * reading
    */
-  long read (ByteBuffer[] srcs) throws IOException;
+  long read(ByteBuffer[] srcs) throws IOException;
 }
index 72abac896541994055371877de067f8dd1c82e61..de1e31d076b747e163e9de5727d78baa81d7dc6c 100644 (file)
@@ -1,4 +1,4 @@
-/* SelectableChannel.java -- 
+/* SelectableChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -41,62 +41,62 @@ import java.io.IOException;
 import java.nio.channels.spi.AbstractInterruptibleChannel;
 import java.nio.channels.spi.SelectorProvider;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
  */
-public abstract class SelectableChannel
-  extends AbstractInterruptibleChannel
+public abstract class SelectableChannel extends AbstractInterruptibleChannel
 {
   /**
    * Initializes the channel.
    */
-  protected SelectableChannel ()
+  protected SelectableChannel()
   {
   }
+
   /**
    * Returns the lock of this channel.
    */
-  public abstract Object blockingLock ();
+  public abstract Object blockingLock();
 
   /**
    * 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)
     throws IOException;
-  
+
   /**
    * Tells whether this channel is blocking or not.
    */
-  public abstract boolean isBlocking ();
-  
+  public abstract boolean isBlocking();
+
   /**
    * Tells whether or not this channel is currently registered with
    * any selectors.
    */
-  public abstract boolean isRegistered ();
-  
+  public abstract boolean isRegistered();
+
   /**
    * Retrieves the key representing the channel's registration with
    * the given selector.
    */
-  public abstract SelectionKey keyFor (Selector sel);
-  
+  public abstract SelectionKey keyFor(Selector sel);
+
   /**
    * Returns the provider that created this channel.
    */
-  public abstract SelectorProvider provider ();
-  
+  public abstract SelectorProvider provider();
+
   /**
    * 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.
@@ -108,12 +108,12 @@ public abstract class SelectableChannel
    * @exception IllegalSelectorException If this channel was not created by
    * the same provider as the given selector.
    */
-  public final SelectionKey register (Selector sel, int ops)
+  public final SelectionKey register(Selector sel, int ops)
     throws ClosedChannelException
   {
-    return register (sel, ops, null);
+    return register(sel, ops, null);
   }
-  
+
   /**
    * Registers this channel with the given selector,
    * returning a selection key.
@@ -130,9 +130,9 @@ public abstract class SelectableChannel
    * @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)
+  public abstract SelectionKey register(Selector sel, int ops, Object att)
     throws ClosedChannelException;
-  
+
   /**
    * Returns a set of valid operations on this channel.
    */
index 39b66f1902ad2b485160664e50a0c5c1249a0ddb..95e7f26fce470c552f8703e0ac7d5cd6027e8cee 100644 (file)
@@ -1,4 +1,4 @@
-/* SelectionKey.java -- 
+/* SelectionKey.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,128 +37,128 @@ 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  = 16;
+  public static final int OP_ACCEPT = 16;
   public static final int OP_CONNECT = 8;
-  public static final int OP_READ    = 1;
-  public static final int OP_WRITE   = 4;
-    
+  public static final int OP_READ = 1;
+  public static final int OP_WRITE = 4;
   Object attached;
-   
+
   /**
    * Initializes the selection key.
    */
-  protected SelectionKey ()
+  protected SelectionKey()
   {
   }
 
   /**
    * Attaches obj to the key and returns the old attached object.
    */
-  public final Object attach (Object obj)
+  public final Object attach(Object obj)
   {
     Object old = attached;
     attached = obj;
     return old;
   }
-   
+
   /**
    * Returns the object attached to the key.
    */
-  public final Object attachment ()
+  public final Object attachment()
   {
     return attached;
-  }    
+  }
 
   /**
    * 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 ()
-  { 
-    return (readyOps () & OP_ACCEPT) != 0;
+  public final boolean isAcceptable()
+  {
+    return (readyOps() & OP_ACCEPT) != 0;
   }
 
   /**
    * 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;
+  }
+
   /**
    * 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;
   }
-  
+
   /**
    * 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;
   }
 
   /**
    * Requests that the registration of this key's channel with
    * its selector be cancelled.
    */
-  public abstract void cancel (); 
+  public abstract void cancel();
+
   /**
    * return the channel attached to the key.
    */
-  public abstract SelectableChannel channel ();
-  
+  public abstract SelectableChannel channel();
+
   /**
    * Returns the key's interest set.
-   * 
+   *
    * @exception CancelledKeyException If this key has been cancelled
    */
-  public abstract int interestOps ();
-  
+  public abstract int interestOps();
+
   /**
    * 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);
+
   /**
    * Tells whether or not this key is valid.
    */
-  public abstract boolean isValid ();
+  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 int readyOps();
+
   /**
    * Returns the selector for which this key was created.
    */
-  public abstract Selector selector ();
+  public abstract Selector selector();
 }
index 695969b5b3ace5b722a80616bd6f7ff5a245c56e..0eee121e27d5efd4aa2b21e67c849e119176b09c 100644 (file)
@@ -1,4 +1,4 @@
-/* Selector.java -- 
+/* Selector.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -41,6 +41,7 @@ import java.io.IOException;
 import java.nio.channels.spi.SelectorProvider;
 import java.util.Set;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
@@ -53,81 +54,81 @@ public abstract class Selector
   protected Selector()
   {
   }
+
   /**
    * Opens a selector.
-   * 
+   *
    * @exception IOException If an error occurs
    */
-  public static Selector open () throws IOException
+  public static Selector open() throws IOException
   {
-    return SelectorProvider.provider ().openSelector ();
+    return SelectorProvider.provider().openSelector();
   }
 
   /**
    * Closes the selector.
-   * 
+   *
    * @exception IOException If an error occurs
    */
-  public abstract void close () throws IOException;
-  
+  public abstract void close() throws IOException;
+
   /**
    * Tells whether the selector is open or not.
    */
-  public abstract boolean isOpen ();
-  
+  public abstract boolean isOpen();
+
   /**
    * Returns this selector's key set.
-   * 
+   *
    * @exception ClosedSelectorException If this selector is closed.
    */
-  public abstract Set keys ();
+  public abstract Set keys();
+
   /**
    * Returns the SelectorProvider that created the selector.
    */
-  public abstract SelectorProvider provider ();
-  
+  public abstract SelectorProvider provider();
+
   /**
    * 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 () throws IOException;
-  
+  public abstract int select() throws IOException;
+
   /**
    * 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) throws IOException;
-  
+  public abstract int select(long timeout) throws IOException;
+
   /**
    * Returns this selector's selected-key set.
-   * 
+   *
    * @exception ClosedSelectorException If this selector is closed.
    */
-  public abstract Set selectedKeys ();
-  
+  public abstract Set selectedKeys();
+
   /**
    * 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 () throws IOException;
-  
+  public abstract int selectNow() throws IOException;
+
   /**
    * Causes the first selection operation that has not yet returned to
    * return immediately.
    */
-  public abstract Selector wakeup ();
+  public abstract Selector wakeup();
 }
index a116731c602ffb9237e6d73ecaa4a7dd9f16aaaf..4b9db4f631666bcec297a2103f86f352fc05d3d7 100644 (file)
@@ -1,4 +1,4 @@
-/* ServerSocketChannel.java -- 
+/* ServerSocketChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -35,29 +35,28 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
-
 package java.nio.channels;
 
-import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.SelectorProvider;
 import java.io.IOException;
 import java.net.ServerSocket;
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.SelectorProvider;
+
 
 /**
  * @author Michael Koch
  * @since 1.4
  */
-public abstract class ServerSocketChannel
-  extends AbstractSelectableChannel
+public abstract class ServerSocketChannel extends AbstractSelectableChannel
 {
   /**
    * Initializes this channel.
    */
-  protected ServerSocketChannel (SelectorProvider provider)
+  protected ServerSocketChannel(SelectorProvider provider)
   {
-    super (provider);
+    super(provider);
   }
-  
+
   /**
    * Accepts a connection made to this channel's socket.
    *
@@ -72,28 +71,28 @@ public abstract class ServerSocketChannel
    * @exception SecurityException If a security manager has been installed and
    * it does not permit access to the remote endpoint of the new connection.
    */
-  public abstract SocketChannel accept () throws IOException;
-  
+  public abstract SocketChannel accept() throws IOException;
+
   /**
    * Retrieves the channels socket.
    */
-  public abstract ServerSocket socket ();
-    
+  public abstract ServerSocket socket();
+
   /**
    * Opens a server socket channel.
    *
    * @exception IOException If an error occurs
    */
-  public static ServerSocketChannel open () throws IOException
+  public static ServerSocketChannel open() throws IOException
   {
-    return SelectorProvider.provider ().openServerSocketChannel ();
+    return SelectorProvider.provider().openServerSocketChannel();
   }
 
   /**
    * Retrieves the valid operations for this channel.
    */
-  public final int validOps ()
+  public final int validOps()
   {
     return SelectionKey.OP_ACCEPT;
-  } 
+  }
 }
index 93633002e513d648a5a8298ecc8d8e7fdfd94374..933f866c9a5b789755407667d0f0a9cdc8bcc4f2 100644 (file)
@@ -1,4 +1,4 @@
-/* SocketChannel.java -- 
+/* SocketChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,38 +37,39 @@ exception statement from your version. */
 
 package java.nio.channels;
 
-import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.SelectorProvider;
-import java.nio.ByteBuffer;
 import java.io.IOException;
 import java.net.Socket;
 import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.SelectorProvider;
+
 
 /**
  * @author Michael Koch
  * @since 1.4
  */
-abstract public class SocketChannel extends AbstractSelectableChannel
+public abstract class SocketChannel extends AbstractSelectableChannel
   implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
 {
   /**
    * Initializes this socket.
    */
-  protected SocketChannel (SelectorProvider provider)
+  protected SocketChannel(SelectorProvider provider)
   {
-    super (provider);
+    super(provider);
   }
+
   /**
    * Opens a socket channel.
    *
    * @exception IOException If an error occurs
    */
-  public static SocketChannel open () throws IOException
+  public static SocketChannel open() throws IOException
   {
-    return SelectorProvider.provider ().openSocketChannel ();
+    return SelectorProvider.provider().openSocketChannel();
   }
-  
+
   /**
    * Opens a channel and connects it to a remote address.
    *
@@ -84,55 +85,53 @@ abstract public class SocketChannel extends AbstractSelectableChannel
    * @exception UnsupportedAddressTypeException If the type of the given remote
    * address is not supported.
    */
-  public static SocketChannel open (SocketAddress remote) throws IOException
+  public static SocketChannel open(SocketAddress remote)
+    throws IOException
   {
-    SocketChannel ch = open ();
+    SocketChannel ch = open();
     ch.connect(remote);
     return ch;
   }
-    
+
   /**
    * Reads data from the channel.
    *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public final long read (ByteBuffer[] dsts) throws IOException
+  public final long read(ByteBuffer[] dsts) throws IOException
   {
     long b = 0;
-    
+
     for (int i = 0; i < dsts.length; i++)
-      {
-        b += read (dsts [i]);
-      }
-    
+      b += read(dsts[i]);
+
     return b;
   }
-    
+
   /**
    * Writes data to the channel.
    *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public final long write (ByteBuffer[] dsts) throws IOException
+  public final long write(ByteBuffer[] dsts) throws IOException
   {
     long b = 0;
 
-    for (int  i= 0; i < dsts.length; i++)
-      {
-        b += write (dsts [i]);
-      }
-    
+    for (int i = 0; i < dsts.length; i++)
+      b += write(dsts[i]);
+
     return b;
-  }    
-   
+  }
+
   /**
    * Retrieves the valid operations for this channel.
    */
-  public final int validOps ()
+  public final int validOps()
   {
-    return SelectionKey.OP_CONNECT | SelectionKey.OP_READ | SelectionKey.OP_WRITE;
+    return SelectionKey.OP_CONNECT | SelectionKey.OP_READ
+           | SelectionKey.OP_WRITE;
   }
 
   /**
@@ -141,7 +140,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract int read (ByteBuffer dst) throws IOException;
+  public abstract int read(ByteBuffer dst) throws IOException;
 
   /**
    * Connects the channel's socket to the remote address.
@@ -162,8 +161,9 @@ abstract public class SocketChannel extends AbstractSelectableChannel
    * @exception UnsupportedAddressTypeException If the type of the given remote
    * address is not supported.
    */
-  public abstract boolean connect (SocketAddress remote) throws IOException;
-  
+  public abstract boolean connect(SocketAddress remote)
+    throws IOException;
+
   /**
    * Finishes the process of connecting a socket channel.
    *
@@ -176,46 +176,46 @@ abstract public class SocketChannel extends AbstractSelectableChannel
    * @exception NoConnectionPendingException If this channel is not connected
    * and a connection operation has not been initiated.
    */
-  public abstract boolean finishConnect () throws IOException;
+  public abstract boolean finishConnect() throws IOException;
+
   /**
    * Tells whether or not the channel's socket is connected.
    */
-  public abstract boolean isConnected ();
-  
+  public abstract boolean isConnected();
+
   /**
    * Tells whether or not a connection operation is in progress on this channel.
    */
-  public abstract boolean isConnectionPending ();
-  
+  public abstract boolean isConnectionPending();
+
   /**
    * Reads data from the channel.
    *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract long read (ByteBuffer[] dsts, int offset, int length)
+  public abstract long read(ByteBuffer[] dsts, int offset, int length)
     throws IOException;
+
   /**
    * Retrieves the channel's socket.
    */
-  public abstract Socket socket ();
-  
+  public abstract Socket socket();
+
   /**
    * Writes data to the channel.
    *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract int write (ByteBuffer src) throws IOException;
-  
+  public abstract int write(ByteBuffer src) throws IOException;
+
   /**
    * Writes data to the channel.
    *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract long write (ByteBuffer[] srcs, int offset, int length)
+  public abstract long write(ByteBuffer[] srcs, int offset, int length)
     throws IOException;
 }
index 1cfdf970dca91488c64b802108232ffc16dfda72..f8e74a9d2f2a368d4a7fe8c1aceccf841187178c 100644 (file)
@@ -1,4 +1,4 @@
-/* UnresolvedAddressException.java -- 
+/* UnresolvedAddressException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 824772a235bed02bbf4c4ea74023b3218de0e919..adea4ed7060f78f5ff0e0a2e7d74b6ac7c1bcc85 100644 (file)
@@ -1,4 +1,4 @@
-/* UnsupportedAddressTypeException.java -- 
+/* UnsupportedAddressTypeException.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
 
 package java.nio.channels;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
index 7b66f5d35a240fb7fd19e8f48aa31e5c5917fc50..0cc6858a402b90bf214476056f0778df98d054f8 100644 (file)
@@ -1,4 +1,4 @@
-/* WritableByteChannel.java -- 
+/* WritableByteChannel.java --
    Copyright (C) 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -40,8 +40,8 @@ package java.nio.channels;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
-public interface WritableByteChannel
-  extends Channel
+
+public interface WritableByteChannel extends Channel
 {
   /**
    * Writes a sequence of bytes to this channel from the given buffer
@@ -56,5 +56,5 @@ public interface WritableByteChannel
    * @exception NonWritableChannelException If this channel was not opened for
    * writing
    */
-  int write (ByteBuffer src) throws IOException;
+  int write(ByteBuffer src) throws IOException;
 }
index 5d9f886ac39261b0a6a880b2b4410e83074ffbd3..98eaf482a2e9167c274004b695f2519ded51f073 100644 (file)
@@ -1,5 +1,5 @@
 /* AbstractInterruptibleChannel.java -- 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,6 +42,7 @@ import java.nio.channels.AsynchronousCloseException;
 import java.nio.channels.Channel;
 import java.nio.channels.InterruptibleChannel;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
@@ -54,25 +55,25 @@ public abstract class AbstractInterruptibleChannel
   /**
    * Initializes the channel.
    */
-  protected AbstractInterruptibleChannel ()
+  protected AbstractInterruptibleChannel()
   {
   }
 
   /**
    * Marks the beginning of an I/O operation that might block indefinitely.
    */
-  protected final void begin ()
+  protected final void begin()
   {
   }
-    
+
   /**
    * Closes the channel.
-   * 
+   *
    * @exception IOException If an error occurs
    */
-  public final void close () throws IOException
+  public final void close() throws IOException
   {
-    if (!closed)
+    if (! closed)
       {
        closed = true;
        implCloseChannel();
@@ -81,29 +82,38 @@ public abstract class AbstractInterruptibleChannel
 
   /**
    * Marks the end of an I/O operation that might block indefinitely.
-   * 
+   *
+   * @param completed true if the task completed successfully,
+   * false otherwise
+   *
+   * @exception IOException if an error occurs
    * @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)
     throws AsynchronousCloseException
   {
-  }   
+    // FIXME: check more here.
+    
+    if (closed) throw new AsynchronousCloseException();
+  }
 
   /**
    * Closes the channel.
-   * 
+   *
    * @exception IOException If an error occurs
    */
-  protected abstract void implCloseChannel () throws IOException;
+  protected abstract void implCloseChannel() throws IOException;
 
   /**
    * Tells whether or not this channel is open.
+   * 
+   * @return true if the channel is open, false otherwise 
    */
-  public final boolean isOpen ()
+  public final boolean isOpen()
   {
-    return !closed;
+    return ! closed;
   }
 }
index a07485df85f1f61bf346b2469af0a50c83bf9e51..ccc48c93c955069b34617fad056e73df8f23c8af 100644 (file)
@@ -43,9 +43,9 @@ import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.util.LinkedList;
-import java.util.List;
 import java.util.ListIterator;
 
+
 public abstract class AbstractSelectableChannel extends SelectableChannel
 {
   private boolean blocking = true;
@@ -55,8 +55,10 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
 
   /**
    * Initializes the channel
+   *
+   * @param provider the provider that created this channel
    */
-  protected AbstractSelectableChannel (SelectorProvider provider)
+  protected AbstractSelectableChannel(SelectorProvider provider)
   {
     this.provider = provider;
   }
@@ -64,27 +66,35 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
   /**
    * Retrieves the object upon which the configureBlocking and register
    * methods synchronize.
+   *
+   * @return the blocking lock
    */
-  public final Object blockingLock ()
+  public final Object blockingLock()
   {
     return LOCK;
   }
-    
+
   /**
    * Adjusts this channel's blocking mode.
+   *
+   * @param blocking true if blocking should be enabled, false otherwise
+   *
+   * @return this channel
+   *
+   * @exception IOException If an error occurs
    */
-  public final SelectableChannel configureBlocking (boolean blocking)
+  public final SelectableChannel configureBlocking(boolean blocking)
     throws IOException
   {
     synchronized (blockingLock())
       {
-        if (this.blocking != blocking)
-          {
-            implConfigureBlocking(blocking);
-            this.blocking = blocking;
-          }
+       if (this.blocking != blocking)
+         {
+           implConfigureBlocking(blocking);
+           this.blocking = blocking;
+         }
       }
-    
+
     return this;
   }
 
@@ -93,25 +103,34 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
    *
    * @exception IOException If an error occurs
    */
-  protected final void implCloseChannel () throws IOException
+  protected final void implCloseChannel() throws IOException
   {
-    implCloseSelectableChannel ();
+    implCloseSelectableChannel();
   }
 
   /**
    * Closes this selectable channel.
+   *
+   * @exception IOException If an error occurs
    */
-  protected abstract void implCloseSelectableChannel () throws IOException;
-  
+  protected abstract void implCloseSelectableChannel()
+    throws IOException;
+
   /**
    * Adjusts this channel's blocking mode.
+   *
+   * @param blocking true if blocking should be enabled, false otherwise
+   *
+   * @exception IOException If an error occurs
    */
-  protected abstract void implConfigureBlocking (boolean block)
+  protected abstract void implConfigureBlocking(boolean blocking)
     throws IOException;
 
   /**
    * Tells whether or not every I/O operation on this channel will block
    * until it completes.
+   *
+   * @return true of this channel is blocking, false otherwise
    */
   public final boolean isBlocking()
   {
@@ -121,87 +140,104 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
   /**
    * Tells whether or not this channel is currently registered with
    * any selectors.
+   *
+   * @return true if this channel is registered, false otherwise
    */
   public final boolean isRegistered()
   {
-    return !keys.isEmpty();
+    return ! keys.isEmpty();
   }
 
   /**
    * Retrieves the key representing the channel's registration with the
    * given selector.
+   *
+   * @param selector the selector to get a selection key for
+   *
+   * @return the selection key this channel is registered with
    */
   public final SelectionKey keyFor(Selector selector)
   {
     if (! isOpen())
       return null;
-    
+
     try
       {
-        synchronized(blockingLock())
+       synchronized (blockingLock())
          {
-           return locate (selector);
+           return locate(selector);
          }
       }
     catch (Exception e)
       {
-        return null;
+       return null;
       }
   }
 
   /**
    * Returns the provider that created this channel.
+   *
+   * @return the selector provider that created this channel
    */
-  public final SelectorProvider provider ()
+  public final SelectorProvider provider()
   {
     return provider;
   }
 
-  private SelectionKey locate (Selector selector)
+  private SelectionKey locate(Selector selector)
   {
-    ListIterator it = keys.listIterator ();
-    
-    while (it.hasNext ())
+    ListIterator it = keys.listIterator();
+
+    while (it.hasNext())
       {
-        SelectionKey key = (SelectionKey) it.next();
-        
-       if (key.selector() == selector)
-          return key;
+       SelectionKey key = (SelectionKey) it.next();
+
+       if (key.selector() == selector)
+         return key;
       }
-    
+
     return null;
   }
 
   /**
    * Registers this channel with the given selector, returning a selection key.
    *
+   * @param selin the seletor to use
+   * @param ops the interested operations
+   * @param att an attachment for the returned selection key
+   *
+   * @return the registered selection key
+   * 
    * @exception ClosedChannelException If the channel is already closed.
    */
-  public final SelectionKey register (Selector selin, int ops, Object att)
+  public final SelectionKey register(Selector selin, int ops, Object att)
     throws ClosedChannelException
   {
-    if (!isOpen ())
+    if (! isOpen())
       throw new ClosedChannelException();
 
+    if ((ops & ~validOps()) != 0)
+      throw new IllegalArgumentException();
+    
     SelectionKey key = null;
     AbstractSelector selector = (AbstractSelector) selin;
 
     synchronized (blockingLock())
       {
-        key = locate (selector);
+       key = locate(selector);
 
-        if (key != null)
-          {
+       if (key != null)
+         {
            if (att != null)
-             key.attach (att);
-          }
-        else
-          {
-            key = selector.register (this, ops, att);
-               
-            if (key != null)
-              addSelectionKey (key);
-          }
+             key.attach(att);
+         }
+       else
+         {
+           key = selector.register(this, ops, att);
+
+           if (key != null)
+             addSelectionKey(key);
+         }
       }
 
     return key;
index 78e0a82cb4a90ff8bf597953693eb3559f943cdf..83d6421bcad68d1421a6cb41327364fb982222f0 100644 (file)
@@ -1,4 +1,4 @@
-/* AbstractSelectionKey.java -- 
+/* AbstractSelectionKey.java --
    Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -39,38 +39,40 @@ package java.nio.channels.spi;
 
 import java.nio.channels.SelectionKey;
 
+
 /**
  * @since 1.4
  */
-public abstract class AbstractSelectionKey
-  extends SelectionKey
+public abstract class AbstractSelectionKey extends SelectionKey
 {
-  private boolean cancelled = false;
+  private boolean cancelled;
 
   /**
    * Initializes the key.
    */
-  protected AbstractSelectionKey ()
+  protected AbstractSelectionKey()
   {
   }
 
   /**
    * Cancels this key.
    */
-  public final void cancel ()
+  public final void cancel()
   {
     if (isValid())
       {
        ((AbstractSelector) selector()).cancelKey(this);
-        cancelled = true;
+       cancelled = true;
       }
   }
 
   /**
    * Tells whether this key is valid or not.
+   *
+   * @return true if this key is valid, false otherwise
    */
-  public final boolean isValid ()
+  public final boolean isValid()
   {
-    return !cancelled;
+    return ! cancelled;
   }
 }
index b657b5ea0d900757316ea3853b4ef3da570ad337..b1e206139d0b35f1b2a20dc715c4ce666aaca05e 100644 (file)
@@ -1,4 +1,4 @@
-/* AbstractSelector.java -- 
+/* AbstractSelector.java --
    Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -35,49 +35,53 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
-
 package java.nio.channels.spi;
 
 import java.io.IOException;
 import java.nio.channels.ClosedSelectorException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
-import java.util.Set;
 import java.util.HashSet;
+import java.util.Set;
+
 
 public abstract class AbstractSelector extends Selector
 {
-  private boolean closed = false;
+  private boolean closed;
   private SelectorProvider provider;
   private HashSet cancelledKeys;
 
   /**
    * Initializes the slector.
+   *
+   * @param provider the provider that created this selector
    */
-  protected AbstractSelector (SelectorProvider provider)
+  protected AbstractSelector(SelectorProvider provider)
   {
     this.provider = provider;
     this.cancelledKeys = new HashSet();
   }
+
   /**
    * Closes the channel.
-   * 
+   *
    * @exception IOException If an error occurs
    */
-  public final synchronized void close () throws IOException
+  public final synchronized void close() throws IOException
   {
     if (closed)
       return;
-    
+
     implCloseSelector();
     closed = true;
   }
 
   /**
    * Tells whether this channel is open or not.
+   *
+   * @return true if channel is open, false otherwise.
    */
-  public final boolean isOpen ()
+  public final boolean isOpen()
   {
     return ! closed;
   }
@@ -95,21 +99,25 @@ public abstract class AbstractSelector extends Selector
   protected final void end()
   {
   }
-    
+
   /**
    * Returns the provider for this selector object.
+   *
+   * @return the SelectorProvider object that created this seletor
    */
-  public final SelectorProvider provider ()
+  public final SelectorProvider provider()
   {
     return provider;
   }
 
   /**
    * Returns the cancelled keys set.
+   *
+   * @return the cancelled keys set
    */
   protected final Set cancelledKeys()
   {
-    if (!isOpen())
+    if (! isOpen())
       throw new ClosedSelectorException();
 
     return cancelledKeys;
@@ -118,8 +126,9 @@ public abstract class AbstractSelector extends Selector
   /**
    * Cancels a selection key.
    */
+
   // This method is only called by AbstractSelectionKey.cancel().
-  final void cancelKey (AbstractSelectionKey key)
+  final void cancelKey(AbstractSelectionKey key)
   {
     synchronized (cancelledKeys)
       {
@@ -129,13 +138,29 @@ public abstract class AbstractSelector extends Selector
 
   /**
    * Closes the channel.
+   *
+   * @exception IOException if an error occurs
    */
-  protected abstract void implCloseSelector () throws IOException;
+  protected abstract void implCloseSelector() throws IOException;
 
-  protected abstract SelectionKey register (AbstractSelectableChannel ch,
-                                            int ops, Object att);   
+  /**
+   * Registers a channel for the selection process.
+   *
+   * @param ch the channel register
+   * @param ops the interested operations
+   * @param att an attachement to the selection key
+   *
+   * @return the registered selection key
+   */
+  protected abstract SelectionKey register(AbstractSelectableChannel ch,
+                                           int ops, Object att);
 
-  protected final void deregister (AbstractSelectionKey key)
+  /**
+   * Deregisters the given selection key.
+   *
+   * @param key the key to deregister
+   */
+  protected final void deregister(AbstractSelectionKey key)
   {
     ((AbstractSelectableChannel) key.channel()).removeSelectionKey(key);
   }
index 1de3e4f83cc1220b903bb188e1cb6a7d6da221f9..ac6e124704dd234af607c221c8f760f0f090d549 100644 (file)
@@ -44,6 +44,7 @@ import java.nio.channels.Pipe;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 
+
 /**
  * @author Michael Koch
  * @since 1.4
@@ -51,76 +52,99 @@ import java.nio.channels.SocketChannel;
 public abstract class SelectorProvider
 {
   private static SelectorProvider systemDefaultProvider;
-    
+
   /**
    * Initializes the selector provider.
    *
    * @exception SecurityException If a security manager has been installed and
    * it denies @see RuntimePermission ("selectorProvider").
    */
-  protected SelectorProvider ()
+  protected SelectorProvider()
   {
-    SecurityManager sm = System.getSecurityManager ();
+    SecurityManager sm = System.getSecurityManager();
     if (sm != null)
-      sm.checkPermission (new RuntimePermission ("selectorProvider"));
+      sm.checkPermission(new RuntimePermission("selectorProvider"));
   }
-  
+
   /**
    * Opens a datagram channel.
+   *
+   * @return a new datagram channel object
+   * 
+   * @exception IOException if an error occurs
    */
-  public abstract DatagramChannel openDatagramChannel () throws IOException;
-  
+  public abstract DatagramChannel openDatagramChannel()
+    throws IOException;
+
   /**
    * Opens a pipe.
+   *
+   * @return a new pipe object
+   * 
+   * @exception IOException if an error occurs
    */
-  public abstract Pipe openPipe () throws IOException;
-  
+  public abstract Pipe openPipe() throws IOException;
+
   /**
    * Opens a selector.
+   *
+   * @return a new selector object
+   * 
+   * @exception IOException if an error occurs
    */
-  public abstract AbstractSelector openSelector () throws IOException;
-  
+  public abstract AbstractSelector openSelector() throws IOException;
+
   /**
    * Opens a server socket channel.
+   *
+   * @return a new server socket channel object
+   * 
+   * @exception IOException if an error occurs
    */
-  public abstract ServerSocketChannel openServerSocketChannel ()
+  public abstract ServerSocketChannel openServerSocketChannel()
     throws IOException;
-  
+
   /**
    * Opens a socket channel.
+   *
+   * @return a new socket channel object
+   * 
+   * @exception IOException if an error occurs
    */
-  public abstract SocketChannel openSocketChannel () throws IOException;
-    
+  public abstract SocketChannel openSocketChannel() throws IOException;
+
   /**
    * Returns the system-wide default selector provider for this invocation
    * of the Java virtual machine.
+   *
+   * @return the default seletor provider
    */
-  public static synchronized SelectorProvider provider ()
+  public static synchronized SelectorProvider provider()
   {
     if (systemDefaultProvider == null)
       {
-        String propertyValue =
-          System.getProperty ("java.nio.channels.spi.SelectorProvider");
-
-        if (propertyValue == null
-            || propertyValue.equals (""))
-          systemDefaultProvider = new SelectorProviderImpl();
-        else
-          {
-            try
-              {
-                systemDefaultProvider = (SelectorProvider) Class.forName
-                  (propertyValue).newInstance();
-              }
-            catch (Exception e)
-              {
-                System.err.println ("Could not instantiate class: "
-                                    + propertyValue);
-                systemDefaultProvider = new SelectorProviderImpl();
-              }
-          }
+       String propertyValue =
+         System.getProperty("java.nio.channels.spi.SelectorProvider");
+
+       if (propertyValue == null || propertyValue.equals(""))
+         systemDefaultProvider = new SelectorProviderImpl();
+       else
+         {
+           try
+             {
+               systemDefaultProvider =
+                 (SelectorProvider) Class.forName(propertyValue)
+                                         .newInstance();
+             }
+           catch (Exception e)
+             {
+               System.err.println("Could not instantiate class: "
+                                  + propertyValue);
+               systemDefaultProvider = new SelectorProviderImpl();
+             }
+         }
       }
-    
+
     return systemDefaultProvider;
   }
 }
index 32346a0457c006d639cd65a292cdad928f222163..1af7a8ef314fdef1c80b2a1e7d5c38217d1883f2 100644 (file)
@@ -40,6 +40,7 @@ package java.nio.charset.spi;
 import java.nio.charset.Charset;
 import java.util.Iterator;
 
+
 /**
  * This class allows an implementor to provide additional character sets. The
  * subclass must have a nullary constructor, and be attached to charset
@@ -82,6 +83,8 @@ public abstract class CharsetProvider
   /**
    * Returns the named charset, by canonical name or alias.
    *
+   * @param name the name of the character
+   *
    * @return the charset, or null if not supported
    */
   public abstract Charset charsetForName(String name);