Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
public final class DatagramChannelImpl
extends DatagramChannel
Constructor Summary | |
|
Method Summary | |
DatagramChannel |
|
DatagramChannel |
|
int | |
protected void |
|
protected void |
|
boolean |
|
boolean |
|
int |
|
long |
|
SocketAddress |
|
int |
|
void |
|
DatagramSocket |
|
int |
|
long |
|
Methods inherited from class java.nio.channels.DatagramChannel | |
connect , disconnect , isConnected , open , read , read , read , receive , send , socket , validOps , write , write , write |
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 | |
blockingLock , configureBlocking , isBlocking , isRegistered , keyFor , provider , register , register , validOps |
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel | |
begin , close , end , implCloseChannel , isOpen |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected DatagramChannelImpl(SelectorProvider provider) throws IOException
Initializes the channel.
public DatagramChannel connect(SocketAddress remote) throws IOException
Connects this channel's socket.
- Overrides:
- connect in interface DatagramChannel
- Throws:
IOException
- If an error occurs.SecurityException
- If a security manager has been installed and it does not permit datagrams to be sent to the given address.
public DatagramChannel disconnect() throws IOException
Disonnects this channel's socket.
- Overrides:
- disconnect in interface DatagramChannel
- Throws:
IOException
- If an error occurs
protected void implCloseSelectableChannel() throws IOException
Closes this selectable channel.
- Overrides:
- implCloseSelectableChannel in interface AbstractSelectableChannel
- Throws:
IOException
- If an error occurs
protected void implConfigureBlocking(boolean blocking) throws IOException
Adjusts this channel's blocking mode.
- Overrides:
- implConfigureBlocking in interface AbstractSelectableChannel
- Parameters:
blocking
- true if blocking should be enabled, false otherwise
- Throws:
IOException
- If an error occurs
public boolean isConnected()
Tells whether or not this channel's socket is connected.
- Overrides:
- isConnected in interface DatagramChannel
- Throws:
NotYetConnectedException
- The channel's socket is not connected.
public final boolean isInChannelOperation()
Indicates whether our datagram socket should ignore whether we are set to non-blocking mode. Certain operations on our socket throw anIllegalBlockingModeException
if we are in non-blocking mode, except if the operation is initiated by us.
public int read(ByteBuffer dst) throws IOException
Reads data from this channel.
- Specified by:
- read in interface ReadableByteChannel
- Overrides:
- read in interface DatagramChannel
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
Reads data from this channel.
- Specified by:
- read in interface ScatteringByteChannel
- Overrides:
- read in interface DatagramChannel
- Throws:
IOException
- If an error occurs.NotYetConnectedException
- The channel's socket is not connected.
public SocketAddress receive(ByteBuffer dst) throws IOException
Receives a datagram via this channel.
- Overrides:
- receive in interface DatagramChannel
- Throws:
IOException
- If an error occursSecurityException
- If a security manager has been installed and it does not permit datagrams to be sent to the given address.
public int send(ByteBuffer src, SocketAddress target) throws IOException
Sends a datagram via this channel.
- Overrides:
- send in interface DatagramChannel
- Throws:
IOException
- If an error occursSecurityException
- If a security manager has been installed and it does not permit datagrams to be sent to the given address.
public final void setInChannelOperation(boolean b)
Sets our indicator of whether we are initiating an I/O operation on our socket.
public DatagramSocket socket()
Retrieves the channel's socket.
- Overrides:
- socket in interface DatagramChannel
public int write(ByteBuffer src) throws IOException
Writes data to this channel.
- Specified by:
- write in interface WritableByteChannel
- Overrides:
- write in interface DatagramChannel
- Throws:
IOException
- If an error occurs.NotYetConnectedException
- The channel's socket is not connected.
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
Writes data to this channel.
- Specified by:
- write in interface GatheringByteChannel
- Overrides:
- write in interface DatagramChannel
- Throws:
IOException
- If an error occurs.NotYetConnectedException
- The channel's socket is not connected.