Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.nio.channels
Class SocketChannel  view SocketChannel download SocketChannel.java

java.lang.Object
  extended byjava.nio.channels.spi.AbstractInterruptibleChannel
      extended byjava.nio.channels.SelectableChannel
          extended byjava.nio.channels.spi.AbstractSelectableChannel
              extended byjava.nio.channels.SocketChannel
All Implemented Interfaces:
ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, WritableByteChannel

public abstract class SocketChannel
extends java.nio.channels.spi.AbstractSelectableChannel
implements ByteChannel, ScatteringByteChannel, GatheringByteChannel

Since:
1.4

Field Summary
 
Fields inherited from class java.nio.channels.spi.AbstractSelectableChannel
 
Fields inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
 
Constructor Summary
protected SocketChannel(java.nio.channels.spi.SelectorProvider provider)
          Initializes this socket channel.
 
Method Summary
abstract  boolean connect(java.net.SocketAddress remote)
          Connects the channel's socket to the remote address.
abstract  boolean finishConnect()
          Finishes the process of connecting a socket channel.
abstract  boolean isConnected()
          Tells whether or not the channel's socket is connected.
abstract  boolean isConnectionPending()
          Tells whether or not a connection operation is in progress on this channel.
static SocketChannel open()
          Opens a socket channel.
static SocketChannel open(java.net.SocketAddress remote)
          Opens a channel and connects it to a remote address.
abstract  int read(java.nio.ByteBuffer dst)
          Reads data from the channel.
 long read(java.nio.ByteBuffer[] dsts)
          Reads data from the channel.
abstract  long read(java.nio.ByteBuffer[] dsts, int offset, int length)
          Reads data from the channel.
abstract  java.net.Socket socket()
          Retrieves the channel's socket.
 int validOps()
          Retrieves the valid operations for this channel.
abstract  int write(java.nio.ByteBuffer src)
          Writes data to the channel.
 long write(java.nio.ByteBuffer[] dsts)
          Writes data to the channel.
abstract  long write(java.nio.ByteBuffer[] srcs, int offset, int length)
          Writes data to the channel.
 
Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, implCloseSelectableChannel, implConfigureBlocking, isBlocking, isRegistered, keyFor, provider, register
 
Methods inherited from class java.nio.channels.SelectableChannel
register
 
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

SocketChannel

protected SocketChannel(java.nio.channels.spi.SelectorProvider provider)
Initializes this socket channel.

Method Detail

open

public static SocketChannel open()
                          throws java.io.IOException
Opens a socket channel.


open

public static SocketChannel open(java.net.SocketAddress remote)
                          throws java.io.IOException
Opens a channel and connects it to a remote address.


read

public final long read(java.nio.ByteBuffer[] dsts)
                throws java.io.IOException
Reads data from the channel.

Specified by:
read in interface ScatteringByteChannel

write

public final long write(java.nio.ByteBuffer[] dsts)
                 throws java.io.IOException
Writes data to the channel.

Specified by:
write in interface GatheringByteChannel

validOps

public final int validOps()
Retrieves the valid operations for this channel.

Specified by:
validOps in class SelectableChannel

read

public abstract int read(java.nio.ByteBuffer dst)
                  throws java.io.IOException
Reads data from the channel.

Specified by:
read in interface ReadableByteChannel

connect

public abstract boolean connect(java.net.SocketAddress remote)
                         throws java.io.IOException
Connects the channel's socket to the remote address.


finishConnect

public abstract boolean finishConnect()
                               throws java.io.IOException
Finishes the process of connecting a socket channel.


isConnected

public abstract boolean isConnected()
Tells whether or not the channel's socket is connected.


isConnectionPending

public abstract boolean isConnectionPending()
Tells whether or not a connection operation is in progress on this channel.


read

public abstract long read(java.nio.ByteBuffer[] dsts,
                          int offset,
                          int length)
                   throws java.io.IOException
Reads data from the channel.

Specified by:
read in interface ScatteringByteChannel

socket

public abstract java.net.Socket socket()
Retrieves the channel's socket.


write

public abstract int write(java.nio.ByteBuffer src)
                   throws java.io.IOException
Writes data to the channel.

Specified by:
write in interface WritableByteChannel

write

public abstract long write(java.nio.ByteBuffer[] srcs,
                           int offset,
                           int length)
                    throws java.io.IOException
Writes data to the channel.

Specified by:
write in interface GatheringByteChannel