Package org.apache.qpid.protonj2.types
Interface DeliveryTag
-
- All Known Implementing Classes:
DeliveryTag.ProtonDeliveryTag
,ProtonSequentialTagGenerator.ProtonNumericDeliveryTag
public interface DeliveryTag
An abstraction around Transfer frames Binary delivery tag which can be used to provide additional features to code sending transfers such as tag pooling etc.- See Also:
ProtonBuffer
,Transfer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DeliveryTag.ProtonDeliveryTag
A default DeliveryTag implementation that can be used by a codec when decoding DeliveryTag instances from the wire.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DeliveryTag
copy()
Create a copy of this delivery tag, the copy should account for any underlying pooling of tags that the tag source's implementation is using.void
release()
Optional method used by tag implementations that provide pooling of tags.ProtonBuffer
tagBuffer()
Returns a view of thisDeliveryTag
object as aProtonBuffer
.byte[]
tagBytes()
Returns a view of thisDeliveryTag
object as a byte array.int
tagLength()
void
writeTo(ProtonBuffer buffer)
Writes the tag as a sequence of bytes into the given buffer in the manner most efficient for the underlyingDeliveryTag
implementation.
-
-
-
Method Detail
-
tagLength
int tagLength()
- Returns:
- the total number of bytes needed to represent the given tag.
-
tagBytes
byte[] tagBytes()
Returns a view of thisDeliveryTag
object as a byte array. The returned array may be the actual underlying tag bytes or a synthetic view based on the value used to generate the tag. It is advised not to modify the returned value and copy if such modification are necessary to the caller.- Returns:
- the underlying tag bytes as a byte array that may or may no be a singleton instance..
-
tagBuffer
ProtonBuffer tagBuffer()
Returns a view of thisDeliveryTag
object as aProtonBuffer
. The returned array may be the actual underlying tag bytes or a synthetic view based on the value used to generate the tag. It is advised not to modify the returned value and copy if such modification are necessary to the caller.- Returns:
- the ProtonBuffer view of the tag bytes.
-
release
void release()
Optional method used by tag implementations that provide pooling of tags. Implementations can do nothing here if no release mechanics are needed.
-
copy
DeliveryTag copy()
Create a copy of this delivery tag, the copy should account for any underlying pooling of tags that the tag source's implementation is using.- Returns:
- a copy of the underlying bytes that compose this delivery tag.
-
writeTo
void writeTo(ProtonBuffer buffer)
Writes the tag as a sequence of bytes into the given buffer in the manner most efficient for the underlyingDeliveryTag
implementation.- Parameters:
buffer
- The target buffer where the tag bytes are to be written.
-
-