Top Description Fields Constructors Methods
org.newsclub.net.unix

public abstract Class AFDatagramChannel<A extends AFSocketAddress>

extends DatagramChannel
implements AFSomeSocket, AFSocketExtensions, AFSomeSocketChannel
Class Inheritance
All Implemented Interfaces
org.newsclub.net.unix.AFSomeSocketChannel, org.newsclub.net.unix.AFSomeSocketThing, org.newsclub.net.unix.FileDescriptorAccess, java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.InterruptibleChannel, java.nio.channels.Channel, org.newsclub.net.unix.AFSocketExtensions, org.newsclub.net.unix.AFSomeSocket
Known Direct Subclasses
org.newsclub.net.unix.AFGenericDatagramChannel, org.newsclub.net.unix.AFUNIXDatagramChannel
Type Parameters
<A>
The supported address type.
Static Imports
java.util.Objects.requireNonNull

A DatagramChannel implementation that works with junixsocket.
Author
Christian Kohlschütter

Field Summary

Modifier and TypeField and Description
private final AFDatagramSocket<A>

Constructor Summary

AccessConstructor and Description
protected
AFDatagramChannel(AFSelectorProvider<A>
The corresponding SelectorProvider.
selectorProvider
,
AFDatagramSocket<A>
The corresponding Socket.
socket
)

Creates a new AFDatagramChannel instance.

Method Summary

Modifier and TypeMethod and Description
public final AFDatagramChannel<A>
bind(SocketAddress
The address to bind the socket, or null to bind the socket to an automatically assigned socket address
local
)

Implements abstract java.nio.channels.DatagramChannel.bind.

Implements java.nio.channels.NetworkChannel.bind.

Binds the channel's socket to a local address.

public final AFDatagramChannel<A>
connect(SocketAddress
The remote address to which this channel is to be connected
remote
)

Implements abstract java.nio.channels.DatagramChannel.connect.

Connects this channel's socket.

public final AFDatagramChannel<A>
disconnect()

Implements abstract java.nio.channels.DatagramChannel.disconnect.

Disconnects this channel's socket.

public final void
ensureAncillaryReceiveBufferSize(int
The minimum size (in bytes).
minSize
)

Implements org.newsclub.net.unix.AFSocketExtensions.ensureAncillaryReceiveBufferSize.

Ensures a minimum ancillary receive buffer size.

pack-priv final AFSocketCore
protected final AFDatagramSocket<A>

Returns:

The socket.
getAFSocket
()

Returns the corresponding Socket.

public final int
getAncillaryReceiveBufferSize()

Implements org.newsclub.net.unix.AFSocketExtensions.getAncillaryReceiveBufferSize.

Returns the size of the receive buffer for ancillary messages (in bytes).

public final FileDescriptor
public final @Nullable A
getLocalAddress()

Implements abstract java.nio.channels.DatagramChannel.getLocalAddress.

Implements java.nio.channels.NetworkChannel.getLocalAddress.

Returns the socket address that this channel's socket is bound to.

public final @Nullable A
getLocalSocketAddress()

Implements org.newsclub.net.unix.AFSomeSocketThing.getLocalSocketAddress.

Returns the socket's local socket address, or null if unavailable or if there was a problem retrieving it.

public final <T> T
getOption(SocketOption<T>
The socket option
name
)

Implements java.nio.channels.NetworkChannel.getOption.

Returns the value of a socket option.

public final @Nullable A
getRemoteAddress()

Implements abstract java.nio.channels.DatagramChannel.getRemoteAddress.

Returns the remote address to which this channel's socket is connected.

public final @Nullable A
getRemoteSocketAddress()

Implements org.newsclub.net.unix.AFSomeSocket.getRemoteSocketAddress.

Returns the socket's remote socket address, or null if unavailable/not connected, or if there was a problem retrieving it.

protected final void
protected final void
implConfigureBlocking(boolean
If true then this channel will be placed in blocking mode; if false then it will be placed non-blocking mode
block
)

Implements abstract java.nio.channels.spi.AbstractSelectableChannel.implConfigureBlocking.

Adjusts this channel's blocking mode.

public final boolean

Returns:

true if the socket successfully bound to an address
isBound
()

Returns the binding state of the socket.

public final boolean
isConnected()

Implements abstract java.nio.channels.DatagramChannel.isConnected.

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

public final boolean

Returns:

true if an attempt is made to delete the socket file upon close().
isDeleteOnClose
()

Checks if this DatagramSocket's bound filename should be removed upon close().

public final MembershipKey
join(InetAddress
The multicast address to join
group
,
NetworkInterface
The network interface on which to join the group
interf
)

Implements java.nio.channels.MulticastChannel.join.

Joins a multicast group to begin receiving all datagrams sent to the group, returning a membership key.

public final MembershipKey
join(InetAddress
The multicast address to join
group
,
NetworkInterface
The network interface on which to join the group
interf
,
InetAddress
The source address
source
)

Implements java.nio.channels.MulticastChannel.join.

Joins a multicast group to begin receiving datagrams sent to the group from a given source address.

public static DatagramChannel

Returns:

The new DatagramChannel.
open
(ProtocolFamily
The protocol family.
family
)

Hides java.nio.channels.DatagramChannel.open.

Opens a datagram channel.

public final int
read(ByteBuffer
The buffer into which bytes are to be transferred
dst
)

Implements abstract java.nio.channels.DatagramChannel.read.

Implements java.nio.channels.ReadableByteChannel.read.

Reads a datagram from this channel.

public final long
read(ByteBuffer[]
The buffers into which bytes are to be transferred
dsts
,
int
The offset within the buffer array of the first buffer into which bytes are to be transferred; must be non-negative and no larger than dsts.length
offset
,
int
The maximum number of buffers to be accessed; must be non-negative and no larger than dsts.length - offset
length
)

Implements abstract java.nio.channels.DatagramChannel.read.

Implements java.nio.channels.ScatteringByteChannel.read.

Reads a datagram from this channel.

public final A
receive(ByteBuffer
The buffer into which the datagram is to be transferred
dst
)

Implements abstract java.nio.channels.DatagramChannel.receive.

Receives a datagram via this channel.

public final int
send(ByteBuffer
The buffer containing the datagram to be sent
src
,
SocketAddress
The address to which the datagram is to be sent
target
)

Implements abstract java.nio.channels.DatagramChannel.send.

Sends a datagram via this channel.

public final void
setAncillaryReceiveBufferSize(int
The size.
size
)

Implements org.newsclub.net.unix.AFSocketExtensions.setAncillaryReceiveBufferSize.

Sets the size of the receive buffer for ancillary messages (in bytes).

public final void
setDeleteOnClose(boolean
Enabled if true.
b
)

Enables/disables deleting this DatagramSocket's bound filename upon close().

public final <T> AFDatagramChannel<A>
setOption(SocketOption<T>
The socket option
name
,
T
The value of the socket option. A value of null may be a valid value for some socket options.
value
)

Implements abstract java.nio.channels.DatagramChannel.setOption.

Implements java.nio.channels.NetworkChannel.setOption.

Sets the value of a socket option.

public void
setShutdownOnClose(boolean
true if enabled.
enabled
)

Implements org.newsclub.net.unix.AFSomeSocketThing.setShutdownOnClose.

Configures whether the socket should be shutdown upon close(), which is the default.

public final AFDatagramSocket<A>
socket()

Implements abstract java.nio.channels.DatagramChannel.socket.

Retrieves a datagram socket associated with this channel.

public final Set<SocketOption<?>>
supportedOptions()

Implements java.nio.channels.NetworkChannel.supportedOptions.

Returns a set of the socket options supported by this channel.

public final int
write(ByteBuffer
The buffer from which bytes are to be retrieved
src
)

Implements abstract java.nio.channels.DatagramChannel.write.

Implements java.nio.channels.WritableByteChannel.write.

Writes a datagram to this channel.

public final long
write(ByteBuffer[]
The buffers from which bytes are to be retrieved
srcs
,
int
The offset within the buffer array of the first buffer from which bytes are to be retrieved; must be non-negative and no larger than srcs.length
offset
,
int
The maximum number of buffers to be accessed; must be non-negative and no larger than srcs.length - offset
length
)

Implements abstract java.nio.channels.DatagramChannel.write.

Implements java.nio.channels.GatheringByteChannel.write.

Writes a datagram to this channel.

Inherited from java.nio.channels.DatagramChannel:
openreadvalidOpswrite

Field Detail

afSocketback to summary
private final AFDatagramSocket<A> afSocket

Constructor Detail

AFDatagramChannelback to summary
protected AFDatagramChannel(AFSelectorProvider<A> selectorProvider, AFDatagramSocket<A> socket)

Creates a new AFDatagramChannel instance.

Parameters
selectorProvider:AFSelectorProvider<A>

The corresponding SelectorProvider.

socket:AFDatagramSocket<A>

The corresponding Socket.

Method Detail

bindback to summary
public final AFDatagramChannel<A> bind(SocketAddress local) throws IOException

Implements abstract java.nio.channels.DatagramChannel.bind.

Implements java.nio.channels.NetworkChannel.bind.

Doc from java.nio.channels.NetworkChannel.bind.

Binds the channel's socket to a local address.

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. If the local parameter has the value null then the socket will be bound to an address that is assigned automatically.

Parameters
local:SocketAddress

The address to bind the socket, or null to bind the socket to an automatically assigned socket address

Returns:AFDatagramChannel<A>

This channel

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.DatagramChannel.bind.

If some other I/O error occurs

connectback to summary
public final AFDatagramChannel<A> connect(SocketAddress remote) throws IOException

Implements abstract java.nio.channels.DatagramChannel.connect.

Doc from java.nio.channels.DatagramChannel.connect.

Connects this channel's socket.

The channel's socket is configured so that it only receives datagrams from, and sends datagrams to, the given remote peer address. Once connected, datagrams may not be received from or sent to any other address. Datagrams in the channel's socket receive buffer, which have not been received before invoking this method, may be discarded. The channel's socket remains connected until it is explicitly disconnected or until it is closed.

This method may be invoked at any time. If another thread has already initiated a read or write operation upon this channel, then an invocation of this method will block until any such operation is complete. If this channel's socket is not bound then this method will first cause the socket to be bound to an address that is assigned automatically, as if invoking the bind method with a parameter of null.

Parameters
remote:SocketAddress

The remote address to which this channel is to be connected

Returns:AFDatagramChannel<A>

This datagram channel

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
disconnectback to summary
public final AFDatagramChannel<A> disconnect() throws IOException

Implements abstract java.nio.channels.DatagramChannel.disconnect.

Doc from java.nio.channels.DatagramChannel.disconnect.

Disconnects this channel's socket.

The channel's socket is configured so that it can receive datagrams from, and sends datagrams to, any remote address.

This method may be invoked at any time. If another thread has already initiated a read or write operation upon this channel, then an invocation of this method will block until any such operation is complete.

If this channel's socket is not connected, or if the channel is closed, then invoking this method has no effect.

Returns:AFDatagramChannel<A>

This datagram channel

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
ensureAncillaryReceiveBufferSizeback to summary
public final void ensureAncillaryReceiveBufferSize(int minSize)

Implements org.newsclub.net.unix.AFSocketExtensions.ensureAncillaryReceiveBufferSize.

Doc from org.newsclub.net.unix.AFSocketExtensions.ensureAncillaryReceiveBufferSize.

Ensures a minimum ancillary receive buffer size.

Parameters
minSize:int

The minimum size (in bytes).

Annotations
@Override
getAFCoreback to summary
pack-priv final AFSocketCore getAFCore()
getAFSocketback to summary
protected final AFDatagramSocket<A> getAFSocket()

Returns the corresponding Socket.

Returns:AFDatagramSocket<A>

The socket.

getAncillaryReceiveBufferSizeback to summary
public final int getAncillaryReceiveBufferSize()

Implements org.newsclub.net.unix.AFSocketExtensions.getAncillaryReceiveBufferSize.

Doc from org.newsclub.net.unix.AFSocketExtensions.getAncillaryReceiveBufferSize.

Returns the size of the receive buffer for ancillary messages (in bytes).

Returns:int

The size.

Annotations
@Override
getFileDescriptorback to summary
public final FileDescriptor getFileDescriptor() throws IOException

Implements org.newsclub.net.unix.FileDescriptorAccess.getFileDescriptor.

Doc from org.newsclub.net.unix.FileDescriptorAccess.getFileDescriptor.

Returns the corresponding FileDescriptor.

Returns:FileDescriptor

The corresponding FileDescriptor.

Annotations
@Override
Exceptions
IOException:
on error.
getLocalAddressback to summary
public final @Nullable A getLocalAddress() throws IOException

Implements abstract java.nio.channels.DatagramChannel.getLocalAddress.

Implements java.nio.channels.NetworkChannel.getLocalAddress.

Doc from java.nio.channels.DatagramChannel.getLocalAddress.

Returns the socket address that this channel's socket is bound to.

Where the channel is bound to an Internet Protocol socket address then the return value from this method is of type java.net.InetSocketAddress.

If the channel's socket was initially bound to the wildcard address and is now connected, then the address returned may be the local address selected as the source address for datagrams sent via this channel instead of the wildcard address. When disconnect is called, the bound address reverts to the wildcard address.

Returns:@Nullable A

The SocketAddress that the socket is bound to; null if the channel's socket is not bound

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
getLocalSocketAddressback to summary
public final @Nullable A getLocalSocketAddress()

Implements org.newsclub.net.unix.AFSomeSocketThing.getLocalSocketAddress.

Doc from org.newsclub.net.unix.AFSomeSocketThing.getLocalSocketAddress.

Returns the socket's local socket address, or null if unavailable or if there was a problem retrieving it.

Returns:@Nullable A

The local socket address, or null.

Annotations
@Override
getOptionback to summary
public final <T> T getOption(SocketOption<T> name) throws IOException

Implements java.nio.channels.NetworkChannel.getOption.

Doc from java.nio.channels.NetworkChannel.getOption.

Returns the value of a socket option.

Parameters
<T>
The type of the socket option value
name:SocketOption<T>

The socket option

Returns:T

The value of the socket option. A value of null may be a valid value for some socket options.

Annotations
@SuppressWarnings:unchecked
@Override
Exceptions
IOException:
If an I/O error occurs
getRemoteAddressback to summary
public final @Nullable A getRemoteAddress() throws IOException

Implements abstract java.nio.channels.DatagramChannel.getRemoteAddress.

Doc from java.nio.channels.DatagramChannel.getRemoteAddress.

Returns the remote address to which this channel's socket is connected.

Returns:@Nullable A

The remote address; null if the channel's socket is not connected

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
getRemoteSocketAddressback to summary
public final @Nullable A getRemoteSocketAddress()

Implements org.newsclub.net.unix.AFSomeSocket.getRemoteSocketAddress.

Doc from org.newsclub.net.unix.AFSomeSocket.getRemoteSocketAddress.

Returns the socket's remote socket address, or null if unavailable/not connected, or if there was a problem retrieving it.

Returns:@Nullable A

The remote socket address, or null.

Annotations
@Override
implCloseSelectableChannelback to summary
protected final void implCloseSelectableChannel() throws IOException

Implements abstract java.nio.channels.spi.AbstractSelectableChannel.implCloseSelectableChannel.

Doc from java.nio.channels.spi.AbstractSelectableChannel.implCloseSelectableChannel.

Closes this selectable channel.

This method is invoked by the close method in order to perform the actual work of closing the channel. This method is only invoked if the channel has not yet been closed, and it is never invoked more than once.

An implementation of this method must arrange for any other thread that is blocked in an I/O operation upon this channel to return immediately, either by throwing an exception or by returning normally.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
implConfigureBlockingback to summary
protected final void implConfigureBlocking(boolean block) throws IOException

Implements abstract java.nio.channels.spi.AbstractSelectableChannel.implConfigureBlocking.

Doc from java.nio.channels.spi.AbstractSelectableChannel.implConfigureBlocking.

Adjusts this channel's blocking mode.

This method is invoked by the configureBlocking method in order to perform the actual work of changing the blocking mode. This method is only invoked if the new mode is different from the current mode.

Parameters
block:boolean

If true then this channel will be placed in blocking mode; if false then it will be placed non-blocking mode

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
isBoundback to summary
public final boolean isBound()

Returns the binding state of the socket.

Returns:boolean

true if the socket successfully bound to an address

isConnectedback to summary
public final boolean isConnected()

Implements abstract java.nio.channels.DatagramChannel.isConnected.

Doc from java.nio.channels.DatagramChannel.isConnected.

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

Returns:boolean

true if, and only if, this channel's socket is open and connected

Annotations
@Override
isDeleteOnCloseback to summary
public final boolean isDeleteOnClose()

Checks if this DatagramSocket's bound filename should be removed upon close(). Deletion is not guaranteed, especially when not supported (e.g., addresses in the abstract namespace).

Returns:boolean

true if an attempt is made to delete the socket file upon close().

joinback to summary
public final MembershipKey join(InetAddress group, NetworkInterface interf) throws IOException

Implements java.nio.channels.MulticastChannel.join.

Doc from java.nio.channels.MulticastChannel.join.

Joins a multicast group to begin receiving all datagrams sent to the group, returning a membership key.

If this channel is currently a member of the group on the given interface to receive all datagrams then the membership key, representing that membership, is returned. Otherwise this channel joins the group and the resulting new membership key is returned. The resulting membership key is not source-specific.

A multicast channel may join several multicast groups, including the same group on more than one interface. An implementation may impose a limit on the number of groups that may be joined at the same time.

Parameters
group:InetAddress

The multicast address to join

interf:NetworkInterface

The network interface on which to join the group

Returns:MembershipKey

The membership key

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
joinback to summary
public final MembershipKey join(InetAddress group, NetworkInterface interf, InetAddress source) throws IOException

Implements java.nio.channels.MulticastChannel.join.

Doc from java.nio.channels.MulticastChannel.join.

Joins a multicast group to begin receiving datagrams sent to the group from a given source address.

If this channel is currently a member of the group on the given interface to receive datagrams from the given source address then the membership key, representing that membership, is returned. Otherwise this channel joins the group and the resulting new membership key is returned. The resulting membership key is source-specific.

Membership is cumulative and this method may be invoked again with the same group and interface to allow receiving datagrams sent by other source addresses to the group.

Parameters
group:InetAddress

The multicast address to join

interf:NetworkInterface

The network interface on which to join the group

source:InetAddress

The source address

Returns:MembershipKey

The membership key

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openback to summary
public static DatagramChannel open(ProtocolFamily family) throws IOException

Hides java.nio.channels.DatagramChannel.open.

Opens a datagram channel. The family parameter specifies the protocol family of the channel's socket.

If the ProtocolFamily is of an AFProtocolFamily, or UNIX, the corresponding junixsocket implementation is used. In all other cases, the call is delegated to DatagramChannel#open().

Parameters
family:ProtocolFamily

The protocol family.

Returns:DatagramChannel

The new DatagramChannel.

Exceptions
IOException:
on error.
readback to summary
public final int read(ByteBuffer dst) throws IOException

Implements abstract java.nio.channels.DatagramChannel.read.

Implements java.nio.channels.ReadableByteChannel.read.

Doc from java.nio.channels.DatagramChannel.read.

Reads a datagram from this channel.

This method may only be invoked if this channel's socket is connected, and it only accepts datagrams from the socket's peer. If there are more bytes in the datagram than remain in the given buffer then the remainder of the datagram is silently discarded. Otherwise this method behaves exactly as specified in the ReadableByteChannel interface.

Parameters
dst:ByteBuffer

Doc from java.nio.channels.ReadableByteChannel.read.

The buffer into which bytes are to be transferred

Returns:int

Doc from java.nio.channels.ReadableByteChannel.read.

The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.ReadableByteChannel.read.

If some other I/O error occurs

readback to summary
public final long read(ByteBuffer[] dsts, int offset, int length) throws IOException

Implements abstract java.nio.channels.DatagramChannel.read.

Implements java.nio.channels.ScatteringByteChannel.read.

Doc from java.nio.channels.DatagramChannel.read.

Reads a datagram from this channel.

This method may only be invoked if this channel's socket is connected, and it only accepts datagrams from the socket's peer. If there are more bytes in the datagram than remain in the given buffers then the remainder of the datagram is silently discarded. Otherwise this method behaves exactly as specified in the ScatteringByteChannel interface.

Parameters
dsts:ByteBuffer[]

Doc from java.nio.channels.ScatteringByteChannel.read.

The buffers into which bytes are to be transferred

offset:int

Doc from java.nio.channels.ScatteringByteChannel.read.

The offset within the buffer array of the first buffer into which bytes are to be transferred; must be non-negative and no larger than dsts.length

length:int

Doc from java.nio.channels.ScatteringByteChannel.read.

The maximum number of buffers to be accessed; must be non-negative and no larger than dsts.length - offset

Returns:long

Doc from java.nio.channels.ScatteringByteChannel.read.

The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.ScatteringByteChannel.read.

If some other I/O error occurs

receiveback to summary
public final A receive(ByteBuffer dst) throws IOException

Implements abstract java.nio.channels.DatagramChannel.receive.

Doc from java.nio.channels.DatagramChannel.receive.

Receives a datagram via this channel.

If a datagram is immediately available, or if this channel is in blocking mode and one eventually becomes available, then the datagram is copied into the given byte buffer and its source address is returned. If this channel is in non-blocking mode and a datagram is not immediately available then this method immediately returns null.

The datagram is transferred into the given byte buffer starting at its current position, as if by a regular read operation. If there are fewer bytes remaining in the buffer than are required to hold the datagram then the remainder of the datagram is silently discarded.

This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete. If this channel's socket is not bound then this method will first cause the socket to be bound to an address that is assigned automatically, as if invoking the bind method with a parameter of null.

Parameters
dst:ByteBuffer

The buffer into which the datagram is to be transferred

Returns:A

The datagram's source address, or null if this channel is in non-blocking mode and no datagram was immediately available

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
sendback to summary
public final int send(ByteBuffer src, SocketAddress target) throws IOException

Implements abstract java.nio.channels.DatagramChannel.send.

Doc from java.nio.channels.DatagramChannel.send.

Sends a datagram via this channel.

If this channel is in non-blocking mode and there is sufficient room in the underlying output buffer, or if this channel is in blocking mode and sufficient room becomes available, then the remaining bytes in the given buffer are transmitted as a single datagram to the given target address.

The datagram is transferred from the byte buffer as if by a regular write operation.

This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete. If this channel's socket is not bound then this method will first cause the socket to be bound to an address that is assigned automatically, as if by invoking the bind method with a parameter of null.

Parameters
src:ByteBuffer

The buffer containing the datagram to be sent

target:SocketAddress

The address to which the datagram is to be sent

Returns:int

The number of bytes sent, which will be either the number of bytes that were remaining in the source buffer when this method was invoked or, if this channel is non-blocking, may be zero if there was insufficient room for the datagram in the underlying output buffer

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
setAncillaryReceiveBufferSizeback to summary
public final void setAncillaryReceiveBufferSize(int size)

Implements org.newsclub.net.unix.AFSocketExtensions.setAncillaryReceiveBufferSize.

Doc from org.newsclub.net.unix.AFSocketExtensions.setAncillaryReceiveBufferSize.

Sets the size of the receive buffer for ancillary messages (in bytes). To disable handling ancillary messages, set it to 0 (default).

Parameters
size:int

The size.

Annotations
@Override
setDeleteOnCloseback to summary
public final void setDeleteOnClose(boolean b)

Enables/disables deleting this DatagramSocket's bound filename upon close(). Deletion is not guaranteed, especially when not supported (e.g., addresses in the abstract namespace).

Parameters
b:boolean

Enabled if true.

setOptionback to summary
public final <T> AFDatagramChannel<A> setOption(SocketOption<T> name, T value) throws IOException

Implements abstract java.nio.channels.DatagramChannel.setOption.

Implements java.nio.channels.NetworkChannel.setOption.

Doc from java.nio.channels.NetworkChannel.setOption.

Sets the value of a socket option.

Parameters
<T>
The type of the socket option value
name:SocketOption<T>

The socket option

value:T

The value of the socket option. A value of null may be a valid value for some socket options.

Returns:AFDatagramChannel<A>

This channel

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.DatagramChannel.setOption.

If an I/O error occurs

setShutdownOnCloseback to summary
public void setShutdownOnClose(boolean enabled)

Implements org.newsclub.net.unix.AFSomeSocketThing.setShutdownOnClose.

Doc from org.newsclub.net.unix.AFSomeSocketThing.setShutdownOnClose.

Configures whether the socket should be shutdown upon close(), which is the default.

Parameters
enabled:boolean

true if enabled.

Annotations
@Override
socketback to summary
public final AFDatagramSocket<A> socket()

Implements abstract java.nio.channels.DatagramChannel.socket.

Doc from java.nio.channels.DatagramChannel.socket.

Retrieves a datagram socket associated with this channel.

Returns:AFDatagramSocket<A>

A datagram socket associated with this channel

Annotations
@SuppressFBWarnings:EI_EXPOSE_REP
@Override
supportedOptionsback to summary
public final Set<SocketOption<?>> supportedOptions()

Implements java.nio.channels.NetworkChannel.supportedOptions.

Doc from java.nio.channels.NetworkChannel.supportedOptions.

Returns a set of the socket options supported by this channel.

This method will continue to return the set of options even after the channel has been closed.

Returns:Set<SocketOption<?>>

A set of the socket options supported by this channel

Annotations
@Override
writeback to summary
public final int write(ByteBuffer src) throws IOException

Implements abstract java.nio.channels.DatagramChannel.write.

Implements java.nio.channels.WritableByteChannel.write.

Doc from java.nio.channels.DatagramChannel.write.

Writes a datagram to this channel.

This method may only be invoked if this channel's socket is connected, in which case it sends datagrams directly to the socket's peer. Otherwise it behaves exactly as specified in the WritableByteChannel interface.

Parameters
src:ByteBuffer

Doc from java.nio.channels.WritableByteChannel.write.

The buffer from which bytes are to be retrieved

Returns:int

Doc from java.nio.channels.WritableByteChannel.write.

The number of bytes written, possibly zero

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.WritableByteChannel.write.

If some other I/O error occurs

writeback to summary
public final long write(ByteBuffer[] srcs, int offset, int length) throws IOException

Implements abstract java.nio.channels.DatagramChannel.write.

Implements java.nio.channels.GatheringByteChannel.write.

Doc from java.nio.channels.DatagramChannel.write.

Writes a datagram to this channel.

This method may only be invoked if this channel's socket is connected, in which case it sends datagrams directly to the socket's peer. Otherwise it behaves exactly as specified in the GatheringByteChannel interface.

Parameters
srcs:ByteBuffer[]

Doc from java.nio.channels.GatheringByteChannel.write.

The buffers from which bytes are to be retrieved

offset:int

Doc from java.nio.channels.GatheringByteChannel.write.

The offset within the buffer array of the first buffer from which bytes are to be retrieved; must be non-negative and no larger than srcs.length

length:int

Doc from java.nio.channels.GatheringByteChannel.write.

The maximum number of buffers to be accessed; must be non-negative and no larger than srcs.length - offset

Returns:long

The number of bytes sent, which will be either the number of bytes that were remaining in the source buffer when this method was invoked or, if this channel is non-blocking, may be zero if there was insufficient room for the datagram in the underlying output buffer

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.channels.GatheringByteChannel.write.

If some other I/O error occurs