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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ByteBufPair.CopyingEncoderstatic final ByteBufPair.Encoder -
Method Summary
Modifier and TypeMethodDescriptionstatic io.netty.buffer.ByteBufcoalesce(ByteBufPair pair) protected voidstatic ByteBufPairget(io.netty.buffer.ByteBuf b1, io.netty.buffer.ByteBuf b2) Get a newByteBufPairfrom the pool and assign 2 buffers to it.io.netty.buffer.ByteBufgetFirst()io.netty.buffer.ByteBufintio.netty.util.ReferenceCountedMethods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, retain, retain, setRefCnt, touch
-
Field Details
-
ENCODER
-
COPYING_ENCODER
-
-
Method Details
-
get
Get a newByteBufPairfrom the pool and assign 2 buffers to it.The buffers b1 and b2 lifecycles are now managed by the ByteBufPair: when the
ByteBufPairis 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:
deallocatein classio.netty.util.AbstractReferenceCounted
-
touch
-