类 PayloadUtils
- java.lang.Object
- org.springframework.messaging.rsocket.PayloadUtils
public abstract class PayloadUtils extends Object
Static utility methods to createPayload
fromDataBuffer
s and vice versa.- 从以下版本开始:
- 5.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 PayloadUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static io.rsocket.Payload
createPayload(DataBuffer data)
Create a Payload with data only.static io.rsocket.Payload
createPayload(DataBuffer data, DataBuffer metadata)
Create a Payload from the given metadata and data.static DataBuffer
retainDataAndReleasePayload(io.rsocket.Payload payload, DataBufferFactory bufferFactory)
Use this method to slice, retain and wrap the data portion of thePayload
, and also to release thePayload
.
构造器详细资料
PayloadUtils
public PayloadUtils()
方法详细资料
retainDataAndReleasePayload
public static DataBuffer retainDataAndReleasePayload(io.rsocket.Payload payload, DataBufferFactory bufferFactory)
Use this method to slice, retain and wrap the data portion of thePayload
, and also to release thePayload
. This assumes the Payload metadata has been read by now and ensures downstream code need only be aware ofDataBuffer
s.- 参数:
payload
- the payload to processbufferFactory
- the DataBufferFactory to wrap with- 返回:
- the created
DataBuffer
instance
createPayload
public static io.rsocket.Payload createPayload(DataBuffer data, DataBuffer metadata)
Create a Payload from the given metadata and data.If at least one is
NettyDataBuffer
thenByteBufPayload
is created with either obtaining the underlying nativeByteBuf
or usingUnpooled.wrappedBuffer(ByteBuffer...)
if necessary. Otherwise, if both areDefaultDataBuffer
, thenDefaultPayload
is created.- 参数:
data
- the data part for the payloadmetadata
- the metadata part for the payload- 返回:
- the created payload
createPayload
public static io.rsocket.Payload createPayload(DataBuffer data)
Create a Payload with data only. The created payload isByteBufPayload
if the input isNettyDataBuffer
or otherwise it isDefaultPayload
.- 参数:
data
- the data part for the payload- 返回:
- created payload