Top Description Constructors Methods
io.netty5.channel

public abstract Class BufferAddressedEnvelope<A extends SocketAddress, T extends BufferAddressedEnvelope<A, T>>

extends DefaultAddressedEnvelope<Buffer, A extends SocketAddress>
implements Resource<T extends BufferAddressedEnvelope<A, T>>
Class Inheritance
All Implemented Interfaces
io.netty5.util.Resource, java.lang.AutoCloseable
Known Direct Subclasses
io.netty5.channel.DefaultBufferAddressedEnvelope, io.netty5.channel.socket.DatagramPacket
Type Parameters
<A>
The type of socket address used for recipient and sender.
<T>
The concrete sub-type of this class, used for implementing send().
Imports
io.netty5.buffer.Buffer, io.netty5.util.Resource, .Send, java.net.SocketAddress, java.util.function.Supplier

Base class for addressed envelopes that have Buffer instances as messages.

Constructor Summary

AccessConstructor and Description
protected
BufferAddressedEnvelope(Buffer message, A recipient, A sender)

protected
BufferAddressedEnvelope(Buffer message, A recipient)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements io.netty5.util.Resource.close.

Close the resource, making it inaccessible.
public boolean
isAccessible()

Implements io.netty5.util.Resource.isAccessible.

Check if this object is accessible.
public abstract T

Returns:

An addressed envelope instance that has the same recipient and sender as this one, but the given content.
replace
(Buffer
The contents of the returned addressed envelope instance.
content
)

Create a new addressed envelope instance, that has the same recipient and sender as this one, but the given content.

public Send<T>
send()

Implements io.netty5.util.Resource.send.

Send this object instance to another Thread, transferring the ownership to the recipient.
Inherited from io.netty5.channel.DefaultAddressedEnvelope:
contentrecipientsendertoString

Constructor Detail

BufferAddressedEnvelopeback to summary
protected BufferAddressedEnvelope(Buffer message, A recipient, A sender)
BufferAddressedEnvelopeback to summary
protected BufferAddressedEnvelope(Buffer message, A recipient)

Method Detail

closeback to summary
public void close()

Implements io.netty5.util.Resource.close.

Doc from io.netty5.util.Resource.close.

Close the resource, making it inaccessible.

Note, this method is not thread-safe unless otherwise specified.

Annotations
@Override
isAccessibleback to summary
public boolean isAccessible()

Implements io.netty5.util.Resource.isAccessible.

Doc from io.netty5.util.Resource.isAccessible.

Check if this object is accessible.

Returns:boolean

true if this object is still valid and can be accessed, otherwise false if, for instance, this object has been dropped/deallocated, or been sent elsewhere.

Annotations
@Override
replaceback to summary
public abstract T replace(Buffer content)

Create a new addressed envelope instance, that has the same recipient and sender as this one, but the given content.

Parameters
content:Buffer

The contents of the returned addressed envelope instance.

Returns:T

An addressed envelope instance that has the same recipient and sender as this one, but the given content.

sendback to summary
public Send<T> send()

Implements io.netty5.util.Resource.send.

Doc from io.netty5.util.Resource.send.

Send this object instance to another Thread, transferring the ownership to the recipient.

The object must be in a state where it can be sent, which includes at least being accessible.

When sent, this instance will immediately become inaccessible, as if by closing it. All attempts at accessing an object that has been sent, even if that object has not yet been received, should cause an exception to be thrown.

Calling close() on an object that has been sent will have no effect, so this method is safe to call within a try-with-resources statement.

Annotations
@Override