/* SocketChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
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;
import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.SelectorProvider;
-
/**
- * @author Michael Koch
+ * @author Michael Koch (konqueror@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)
{
/**
* Opens a socket channel.
*
+ * @return the new <code>SocketChannel</code> object
+ *
* @exception IOException If an error occurs
*/
public static SocketChannel open() throws IOException
/**
* 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
/**
* 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.
*/
/**
* 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.
*/
/**
* Retrieves the valid operations for this channel.
+ *
+ * @return the valid operations
*/
public final int validOps()
{
/**
* 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.
*/
/**
* 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
/**
* 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.
*/
/**
* 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.
*/
/**
* 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.
*/