Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.nio.channels

Class DatagramChannel

java.lang.Object
|
+--java.nio.channels.spi.AbstractInterruptibleChannel
   |
   +--java.nio.channels.SelectableChannel
      |
      +--java.nio.channels.spi.AbstractSelectableChannel
         |
         +--java.nio.channels.DatagramChannel

All Implemented Interfaces:

ByteChannel, ScatteringByteChannel, GatheringByteChannel, Channel, InterruptibleChannel


public abstract class DatagramChannel

extends AbstractSelectableChannel

implements ByteChannel, ScatteringByteChannel, GatheringByteChannel

Since:

Constructor Summary

DatagramChannel(java.nio.channels.spi.SelectorProvider provider)

Initializes the channel.

Method Summary

java.nio.channels.DatagramChannelconnect(java.net.SocketAddress remote)

Connects this channel's socket.
java.nio.channels.DatagramChanneldisconnect()

Disonnects this channel's socket.
booleanisConnected()

Tells whether or not this channel's socket is connected.
static java.nio.channels.DatagramChannelopen()

Opens a datagram channel.
longread(java.nio.ByteBuffer[] dsts)

Reads data from this channel.
intread(java.nio.ByteBuffer dst)

Reads data from this channel.
longread(java.nio.ByteBuffer[] dsts, int offset, int length)

Reads data from this channel.
java.net.SocketAddressreceive(java.nio.ByteBuffer dst)

Receives a datagram via this channel.
intsend(java.nio.ByteBuffer src, java.net.SocketAddress target)

Sends a datagram via this channel.
java.net.DatagramSocketsocket()

Retrieves the channel's socket.
intvalidOps()

Retrieves the valid operations for this channel.
longwrite(java.nio.ByteBuffer[] srcs)

Writes data to this channel.
intwrite(java.nio.ByteBuffer src)

Writes data to this channel.
longwrite(java.nio.ByteBuffer[] srcs, int offset, int length)

Writes data to this channel.

Constructor Details

DatagramChannel

protected DatagramChannel(java.nio.channels.spi.SelectorProvider provider)

Initializes the channel.

Parameters:


Method Details

connect

public DatagramChannel connect(java.net.SocketAddress remote)

Connects this channel's socket.

Parameters:

Throws:


disconnect

public DatagramChannel disconnect()

Disonnects this channel's socket.

Throws:


isConnected

public boolean isConnected()

Tells whether or not this channel's socket is connected.

Throws:


open

public static DatagramChannel open()

Opens a datagram channel.

Throws:


read

public final long read(java.nio.ByteBuffer[] dsts)

Reads data from this channel.

Parameters:


read

public int read(java.nio.ByteBuffer dst)

Reads data from this channel.

Parameters:


read

public long read(java.nio.ByteBuffer[] dsts, int offset, int length)

Reads data from this channel.

Parameters:

Throws:


receive

public SocketAddress receive(java.nio.ByteBuffer dst)

Receives a datagram via this channel.

Parameters:

Throws:


send

public int send(java.nio.ByteBuffer src, java.net.SocketAddress target)

Sends a datagram via this channel.

Parameters:

Throws:


socket

public DatagramSocket socket()

Retrieves the channel's socket.


validOps

public final int validOps()

Retrieves the valid operations for this channel.

Throws:


write

public final long write(java.nio.ByteBuffer[] srcs)

Writes data to this channel.

Parameters:

Throws:


write

public int write(java.nio.ByteBuffer src)

Writes data to this channel.

Parameters:

Throws:


write

public long write(java.nio.ByteBuffer[] srcs, int offset, int length)

Writes data to this channel.

Parameters:

Throws: