public final class ByteBufPayload extends AbstractReferenceCounted implements Payload
| Modifier and Type | Method and Description |
|---|---|
static Payload |
create(byte[] data) |
static Payload |
create(byte[] data,
byte[] metadata) |
static Payload |
create(ByteBuf data) |
static Payload |
create(ByteBuf data,
ByteBuf metadata) |
static Payload |
create(ByteBuffer data) |
static Payload |
create(ByteBuffer data,
ByteBuffer metadata) |
static Payload |
create(CharSequence data,
Charset dataCharset) |
static Payload |
create(CharSequence data,
Charset dataCharset,
CharSequence metadata,
Charset metadataCharset) |
static Payload |
create(Payload payload) |
static Payload |
create(String data)
Static factory method for a text payload.
|
static Payload |
create(String data,
String metadata)
Static factory method for a text payload.
|
ByteBuf |
data()
Returns the Payloads' data without slicing if possible.
|
protected void |
deallocate() |
boolean |
hasMetadata()
Returns whether the payload has metadata, useful for tell if metadata is empty or not present.
|
ByteBuf |
metadata()
Returns the Payloads' metadata without slicing if possible.
|
ByteBufPayload |
retain()
Increases the reference count by
1. |
ByteBufPayload |
retain(int increment)
Increases the reference count by the specified
increment. |
ByteBuf |
sliceData()
Returns the Payload data.
|
ByteBuf |
sliceMetadata()
Returns a slice Payload metadata.
|
ByteBufPayload |
touch()
Records the current access location of this object for debugging purposes.
|
ByteBufPayload |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for
debugging purposes.
|
refCnt, release, release, setRefCntclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetData, getDataUtf8, getMetadata, getMetadataUtf8refCnt, release, releasepublic static Payload create(String data)
data - the data of the payload.public static Payload create(String data, @Nullable String metadata)
data - the data of the payload.metadata - the metadata for the payload.public static Payload create(CharSequence data, Charset dataCharset)
public static Payload create(CharSequence data, Charset dataCharset, @Nullable CharSequence metadata, Charset metadataCharset)
public static Payload create(byte[] data)
public static Payload create(ByteBuffer data)
public static Payload create(ByteBuffer data, @Nullable ByteBuffer metadata)
public boolean hasMetadata()
PayloadhasMetadata in interface Payloadpublic ByteBuf sliceMetadata()
PayloadPayload.hasMetadata() to
differentiate null from "".sliceMetadata in interface Payloadpublic ByteBuf data()
Payloadpublic ByteBuf metadata()
Payloadpublic ByteBuf sliceData()
Payloadpublic ByteBufPayload retain()
Payload1.retain in interface ReferenceCountedretain in interface Payloadretain in class AbstractReferenceCountedpublic ByteBufPayload retain(int increment)
Payloadincrement.retain in interface ReferenceCountedretain in interface Payloadretain in class AbstractReferenceCountedpublic ByteBufPayload touch()
PayloadResourceLeakDetector. This method is a shortcut to touch(null).touch in interface ReferenceCountedtouch in interface Payloadtouch in class AbstractReferenceCountedpublic ByteBufPayload touch(Object hint)
PayloadResourceLeakDetector.touch in interface ReferenceCountedtouch in interface Payloadprotected void deallocate()
deallocate in class AbstractReferenceCounted