Compartilhar via


DatagramChannel.Write Method

Definition

Overloads

Write(ByteBuffer[])

Writes a datagram to this channel.

Write(ByteBuffer)

Writes a datagram to this channel.

Write(ByteBuffer[], Int32, Int32)

Writes a datagram to this channel.

Write(ByteBuffer[])

Writes a datagram to this channel.

[Android.Runtime.Register("write", "([Ljava/nio/ByteBuffer;)J", "")]
public long Write (Java.Nio.ByteBuffer[]? srcs);
[<Android.Runtime.Register("write", "([Ljava/nio/ByteBuffer;)J", "")>]
abstract member Write : Java.Nio.ByteBuffer[] -> int64
override this.Write : Java.Nio.ByteBuffer[] -> int64

Parameters

srcs
ByteBuffer[]

Returns

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

Implements

Attributes

Exceptions

if the channel is not connected yet.

if the channel is already closed.

if the channel is closed by another thread while this method is in operation.

if another thread interrupts the calling thread while the operation is in progress. The calling thread will have the interrupt state set and the channel will be closed.

some other I/O error occurs.

Remarks

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.

Java documentation for java.nio.channels.DatagramChannel.write(java.nio.ByteBuffer[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Write(ByteBuffer)

Writes a datagram to this channel.

[Android.Runtime.Register("write", "(Ljava/nio/ByteBuffer;)I", "GetWrite_Ljava_nio_ByteBuffer_Handler")]
public abstract int Write (Java.Nio.ByteBuffer? src);
[<Android.Runtime.Register("write", "(Ljava/nio/ByteBuffer;)I", "GetWrite_Ljava_nio_ByteBuffer_Handler")>]
abstract member Write : Java.Nio.ByteBuffer -> int

Parameters

Returns

Implements

Attributes

Exceptions

if the channel is not connected yet.

if the channel is already closed.

if the channel is closed by another thread while this method is in operation.

if another thread interrupts the calling thread while the operation is in progress. The calling thread will have the interrupt state set and the channel will be closed.

some other I/O error occurs.

Remarks

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.

Java documentation for java.nio.channels.DatagramChannel.write(java.nio.ByteBuffer).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Write(ByteBuffer[], Int32, Int32)

Writes a datagram to this channel.

[Android.Runtime.Register("write", "([Ljava/nio/ByteBuffer;II)J", "GetWrite_arrayLjava_nio_ByteBuffer_IIHandler")]
public abstract long Write (Java.Nio.ByteBuffer[]? srcs, int offset, int length);
[<Android.Runtime.Register("write", "([Ljava/nio/ByteBuffer;II)J", "GetWrite_arrayLjava_nio_ByteBuffer_IIHandler")>]
abstract member Write : Java.Nio.ByteBuffer[] * int * int -> int64

Parameters

srcs
ByteBuffer[]
offset
Int32

a non-negative offset in the array of buffers, pointing to the starting buffer to be retrieved, must be no larger than sources.length.

length
Int32

a non-negative length to indicate the maximum number of buffers to be submitted, must be no bigger than sources.length - offset.

Returns

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

Implements

Attributes

Exceptions

if the channel is not connected yet.

if the channel is already closed.

if the channel is closed by another thread while this method is in operation.

if another thread interrupts the calling thread while the operation is in progress. The calling thread will have the interrupt state set and the channel will be closed.

some other I/O error occurs.

Remarks

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.

Java documentation for java.nio.channels.DatagramChannel.write(java.nio.ByteBuffer[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Java.Nio.Channels.IGatheringByteChannel.Write(Java.Nio.ByteBuffer%5b%5d%2c+System.Int32%2c+System.Int32)>

Applies to