Class ByteBufPair
java.lang.Object
io.netty.util.AbstractReferenceCounted
org.apache.pulsar.common.protocol.ByteBufPair
- All Implemented Interfaces:
io.netty.util.ReferenceCounted
public final class ByteBufPair
extends io.netty.util.AbstractReferenceCounted
ByteBuf holder that contains 2 buffers.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ByteBufPair.CopyingEncoder
static final ByteBufPair.Encoder
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.netty.buffer.ByteBuf
coalesce
(ByteBufPair pair) protected void
static ByteBufPair
get
(io.netty.buffer.ByteBuf b1, io.netty.buffer.ByteBuf b2) Get a newByteBufPair
from the pool and assign 2 buffers to it.io.netty.buffer.ByteBuf
getFirst()
io.netty.buffer.ByteBuf
int
io.netty.util.ReferenceCounted
Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, retain, retain, setRefCnt, touch
-
Field Details
-
ENCODER
-
COPYING_ENCODER
-
-
Method Details
-
get
Get a newByteBufPair
from the pool and assign 2 buffers to it.The buffers b1 and b2 lifecycles are now managed by the ByteBufPair: when the
ByteBufPair
is deallocated, b1 and b2 will be released as well.- Parameters:
b1
-b2
-- Returns:
-
getFirst
public io.netty.buffer.ByteBuf getFirst() -
getSecond
public io.netty.buffer.ByteBuf getSecond() -
readableBytes
public int readableBytes() -
coalesce
- Returns:
- a single buffer with the content of both individual buffers
-
deallocate
protected void deallocate()- Specified by:
deallocate
in classio.netty.util.AbstractReferenceCounted
-
touch
-