|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.SelectableChannel
java.nio.channels.spi.AbstractSelectableChannel
java.nio.channels.SocketChannel
public abstract class SocketChannel
Constructor Summary | |
---|---|
protected |
SocketChannel(SelectorProvider provider)
Initializes this socket channel. |
Method Summary | |
---|---|
abstract boolean |
connect(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(SocketAddress remote)
Opens a channel and connects it to a remote address. |
abstract int |
read(ByteBuffer dst)
Reads data from the channel. |
long |
read(ByteBuffer[] dsts)
Reads data from the channel. |
abstract long |
read(ByteBuffer[] dsts,
int offset,
int length)
Reads data from the channel. |
abstract Socket |
socket()
Retrieves the channel's socket. |
int |
validOps()
Retrieves the valid operations for this channel. |
abstract int |
write(ByteBuffer src)
Writes data to the channel. |
long |
write(ByteBuffer[] dsts)
Writes data to the channel. |
abstract long |
write(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 |
---|
protected SocketChannel(SelectorProvider provider)
Method Detail |
---|
public static SocketChannel open() throws IOException
SocketChannel
object
IOException
- If an error occurspublic static SocketChannel open(SocketAddress remote) throws IOException
SocketChannel
object
AsynchronousCloseException
- If this channel is already connected.
ClosedByInterruptException
- If another thread interrupts the
current thread while the connect operation is in progress, thereby closing
the channel and setting the current thread's interrupt status.
IOException
- If an error occurs
SecurityException
- If a security manager has been installed and
it does not permit access to the given remote endpoint.
UnresolvedAddressException
- If the given remote address is not
fully resolved.
UnsupportedAddressTypeException
- If the type of the given remote
address is not supported.public final long read(ByteBuffer[] dsts) throws IOException
read
in interface ScatteringByteChannel
IOException
- If an error occurs
NotYetConnectedException
- If this channel is not yet connected.public final long write(ByteBuffer[] dsts) throws IOException
write
in interface GatheringByteChannel
IOException
- If an error occurs
NotYetConnectedException
- If this channel is not yet connected.public final int validOps()
validOps
in class SelectableChannel
public abstract int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
dst
- the buffer to put the read data into
IOException
- If an error occurs
NotYetConnectedException
- If this channel is not yet connected.public abstract boolean connect(SocketAddress remote) throws IOException
true
if the channel got successfully connected,
false
if the channel is in non-blocking mode and connection
operation is still in progress.
AlreadyConnectedException
- If this channel is already connected.
AsynchronousCloseException
- If this channel is already connected.
ClosedByInterruptException
- If another thread interrupts the
current thread while the connect operation is in progress, thereby closing
the channel and setting the current thread's interrupt status.
ClosedChannelException
- If this channel is closed.
ConnectionPendingException
- If a non-blocking connection
operation is already in progress on this channel.
IOException
- If an error occurs
SecurityException
- If a security manager has been installed and
it does not permit access to the given remote endpoint.
UnresolvedAddressException
- If the given remote address is not
fully resolved.
UnsupportedAddressTypeException
- If the type of the given remote
address is not supported.public abstract boolean finishConnect() throws IOException
AsynchronousCloseException
- If this channel is already connected.
ClosedByInterruptException
- If another thread interrupts the
current thread while the connect operation is in progress, thereby closing
the channel and setting the current thread's interrupt status.
ClosedChannelException
- If this channel is closed.
IOException
- If an error occurs
NoConnectionPendingException
- If this channel is not connected
and a connection operation has not been initiated.public abstract boolean isConnected()
public abstract boolean isConnectionPending()
public abstract long read(ByteBuffer[] dsts, int offset, int length) throws IOException
read
in interface ScatteringByteChannel
IOException
- If an error occurs
NotYetConnectedException
- If this channel is not yet connected.public abstract Socket socket()
public abstract int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
IOException
- If an error occurs
NotYetConnectedException
- If this channel is not yet connected.public abstract long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write
in interface GatheringByteChannel
IOException
- If an error occurs
NotYetConnectedException
- If this channel is not yet connected.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |