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, setRefCnt
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getData, getDataUtf8, getMetadata, getMetadataUtf8
refCnt, release, release
public 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()
Payload
hasMetadata
in interface Payload
public ByteBuf sliceMetadata()
Payload
Payload.hasMetadata()
to
differentiate null from "".sliceMetadata
in interface Payload
public ByteBuf data()
Payload
public ByteBuf metadata()
Payload
public ByteBuf sliceData()
Payload
public ByteBufPayload retain()
Payload
1
.retain
in interface ReferenceCounted
retain
in interface Payload
retain
in class AbstractReferenceCounted
public ByteBufPayload retain(int increment)
Payload
increment
.retain
in interface ReferenceCounted
retain
in interface Payload
retain
in class AbstractReferenceCounted
public ByteBufPayload touch()
Payload
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ReferenceCounted
touch
in interface Payload
touch
in class AbstractReferenceCounted
public ByteBufPayload touch(Object hint)
Payload
ResourceLeakDetector
.touch
in interface ReferenceCounted
touch
in interface Payload
protected void deallocate()
deallocate
in class AbstractReferenceCounted