|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface NetworkChannel
A channel to a network socket.
A channel that implements this interface is a channel to a network
socket. The bind(java.net.SocketAddress) method is used to bind the socket to a local
address, the getLocalAddress() method
returns the address that the socket is bound to, and the
setOption(com.sun.sgs.nio.channels.SocketOption, java.lang.Object) and getOption(com.sun.sgs.nio.channels.SocketOption) methods are used to set and
query socket options. An implementation of this interface should specify
the socket options that it supports.
The {#link #bind} and setOption(com.sun.sgs.nio.channels.SocketOption, java.lang.Object) methods that do not otherwise
have a value to return are specified to return the network channel upon
which they are invoked. This allows method invocations to be chained.
Implementations of this interface should specialize the return type so
that method invocations on the implementation class can be chained.
| Method Summary | |
|---|---|
NetworkChannel |
bind(SocketAddress local)
Binds the channel's socket to a local address. |
SocketAddress |
getLocalAddress()
Returns the socket address that this channel's socket is bound to, or null if the socket is not bound. |
Object |
getOption(SocketOption name)
Returns the value of a socket option. |
Set<SocketOption> |
options()
Returns a set of the socket options supported by this channel. |
NetworkChannel |
setOption(SocketOption name,
Object value)
Sets the value of a socket option. |
| Methods inherited from interface java.nio.channels.Channel |
|---|
close, isOpen |
| Method Detail |
|---|
NetworkChannel bind(SocketAddress local)
throws IOException
This method is used to establish an association between the socket
and a local address. Once an association is established then the
socket remains bound until the channel is closed. An attempt to bind
a socket that is already bound throws AlreadyBoundException.
If the local parameter has the value null then the
socket will be bound to an address that is assigned automatically.
An implementation of this interface should specify if a permission is required when a security manager is installed.
local - the address to bind the socket, or null to bind the
socket to an automatically assigned socket address
AlreadyBoundException - if the socket is already bound
UnsupportedAddressTypeException - if the type of the given
address is not supported
ClosedChannelException - if the channel is closed
IOException - if some other I/O error occurs
SocketAddress getLocalAddress()
throws IOException
null if the socket is not bound.
null
if the channel is not open
or the channel's socket is not bound
IOException - if an I/O error occurs
NetworkChannel setOption(SocketOption name,
Object value)
throws IOException
The name parameter is the name of the socket option.
The value parameter is the value of the option and is of the
type specified by the option. A value of
null may be a valid value for some socket options.
name - the name of the socket optionvalue - the value of the socket option
IllegalArgumentException - If the socket option is not
supported by this channel, or the value is not a valid value
for this socket option
ClosedChannelException - if this channel is closed
IOException - if an I/O error occursSocketOption
Object getOption(SocketOption name)
throws IOException
The return type is specific to the socket option and null
may be a valid value for some socket options.
name - the socket option
IllegalArgumentException - if the socket option is not
supported by this channel
ClosedChannelException - if this channel is closed
IOException - if an I/O error occursSocketOptionSet<SocketOption> options()
This method will continue to return the set of options even after the channel has been closed.
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||