[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: small NIO fixes

Kaffe CVS cvs-commits at kaffe.org
Thu Dec 2 11:40:06 PST 2004


PatchSet 5507 
Date: 2004/12/02 19:35:46
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: small NIO fixes

2004-12-02  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/gnu/java/nio/SocketChannelImpl.java,
        libraries/javalib/java/nio/channels/SocketChannel.java:
        Resynced with GNU Classpath.

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

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

Members: 
	ChangeLog:1.3053->1.3054 
	libraries/javalib/gnu/java/nio/SocketChannelImpl.java:1.14->1.15 
	libraries/javalib/java/nio/channels/SocketChannel.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3053 kaffe/ChangeLog:1.3054
--- kaffe/ChangeLog:1.3053	Thu Dec  2 19:29:18 2004
+++ kaffe/ChangeLog	Thu Dec  2 19:35:46 2004
@@ -1,5 +1,19 @@
 2004-12-02  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/gnu/java/nio/SocketChannelImpl.java,
+	libraries/javalib/java/nio/channels/SocketChannel.java:
+        Resynced with GNU Classpath.
+
+	2004-11-21  Michael Koch  <konqueror at gmx.de>
+
+	* gnu/java/nio/SocketChannelImpl.java
+	(read): Only return 0 when no bytes for reading available in
+	non-blocking mode.
+	* java/nio/channels/SocketChannel.java:
+	Added some missing @return tags.
+
+2004-12-02  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/beans/PropertyChangeSupport.java,
 	libraries/javalib/java/beans/VetoableChangeSupport.java:
         Resynced with GNU Classpath.
Index: kaffe/libraries/javalib/gnu/java/nio/SocketChannelImpl.java
diff -u kaffe/libraries/javalib/gnu/java/nio/SocketChannelImpl.java:1.14 kaffe/libraries/javalib/gnu/java/nio/SocketChannelImpl.java:1.15
--- kaffe/libraries/javalib/gnu/java/nio/SocketChannelImpl.java:1.14	Mon Jul 26 21:13:52 2004
+++ kaffe/libraries/javalib/gnu/java/nio/SocketChannelImpl.java	Thu Dec  2 19:35:48 2004
@@ -182,7 +182,7 @@
     // FIXME: Handle blocking/non-blocking mode.
 
     Selector selector = provider().openSelector();
-    register (selector, SelectionKey.OP_CONNECT);
+    register(selector, SelectionKey.OP_CONNECT);
 
     if (isBlocking())
       {
@@ -216,7 +216,7 @@
     return socket;
   }
 
-  public int read (ByteBuffer dst) throws IOException
+  public int read(ByteBuffer dst) throws IOException
   {
     if (!isConnected())
       throw new NotYetConnectedException();
@@ -227,7 +227,7 @@
     int available = input.available();
     int len = dst.capacity() - dst.position();
 	
-    if (available == 0)
+    if (! isBlocking() && available == 0)
       return 0;
     
     if (len > available)
Index: kaffe/libraries/javalib/java/nio/channels/SocketChannel.java
diff -u kaffe/libraries/javalib/java/nio/channels/SocketChannel.java:1.5 kaffe/libraries/javalib/java/nio/channels/SocketChannel.java:1.6
--- kaffe/libraries/javalib/java/nio/channels/SocketChannel.java:1.5	Mon Apr 12 11:40:31 2004
+++ kaffe/libraries/javalib/java/nio/channels/SocketChannel.java	Thu Dec  2 19:35:48 2004
@@ -1,5 +1,5 @@
 /* SocketChannel.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@
 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.io.IOException;
@@ -44,16 +45,15 @@
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.nio.channels.spi.SelectorProvider;
 
-
 /**
- * @author Michael Koch
+ * @author Michael Koch (konqueror at gmx.de)
  * @since 1.4
  */
 public abstract class SocketChannel extends AbstractSelectableChannel
   implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
 {
   /**
-   * Initializes this socket.
+   * Initializes this socket channel.
    */
   protected SocketChannel(SelectorProvider provider)
   {
@@ -63,6 +63,8 @@
   /**
    * Opens a socket channel.
    *
+   * @return the new <code>SocketChannel</code> object
+   * 
    * @exception IOException If an error occurs
    */
   public static SocketChannel open() throws IOException
@@ -73,6 +75,8 @@
   /**
    * Opens a channel and connects it to a remote address.
    *
+   * @return the new <code>SocketChannel</code> object
+   * 
    * @exception AsynchronousCloseException If this channel is already connected.
    * @exception ClosedByInterruptException If another thread interrupts the
    * current thread while the connect operation is in progress, thereby closing
@@ -96,6 +100,9 @@
   /**
    * Reads data from the channel.
    *
+   * @return the number of bytes read, zero is valid too, -1 if end of stream
+   * is reached
+   *
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
@@ -112,6 +119,8 @@
   /**
    * Writes data to the channel.
    *
+   * @return the number of bytes written, zero is valid too
+   * 
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
@@ -127,6 +136,8 @@
 
   /**
    * Retrieves the valid operations for this channel.
+   *
+   * @return the valid operations
    */
   public final int validOps()
   {
@@ -137,6 +148,9 @@
   /**
    * Reads data from the channel.
    *
+   * @return the number of bytes read, zero is valid too, -1 if end of stream
+   * is reached
+   * 
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
@@ -145,6 +159,10 @@
   /**
    * Connects the channel's socket to the remote address.
    *
+   * @return <code>true</code> if the channel got successfully connected,
+   * <code>false</code> if the channel is in non-blocking mode and connection
+   * operation is still in progress.
+   * 
    * @exception AlreadyConnectedException If this channel is already connected.
    * @exception AsynchronousCloseException If this channel is already connected.
    * @exception ClosedByInterruptException If another thread interrupts the
@@ -191,6 +209,9 @@
   /**
    * Reads data from the channel.
    *
+   * @return the number of bytes read, zero is valid too, -1 if end of stream
+   * is reached
+   * 
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
@@ -199,12 +220,16 @@
 
   /**
    * Retrieves the channel's socket.
+   *
+   * @return the socket
    */
   public abstract Socket socket();
 
   /**
    * Writes data to the channel.
    *
+   * @return the number of bytes written, zero is valid too
+   * 
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
@@ -213,6 +238,8 @@
   /**
    * Writes data to the channel.
    *
+   * @return the number of bytes written, zero is valid too
+   * 
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */




More information about the kaffe mailing list