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.AbstractReferenceCountedByteBuf holder that contains 2 buffers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classByteBufPair.CopyingEncoderstatic classByteBufPair.Encoder
-
Field Summary
Fields Modifier and Type Field Description static ByteBufPair.CopyingEncoderCOPYING_ENCODERstatic ByteBufPair.EncoderENCODER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static io.netty.buffer.ByteBufcoalesce(ByteBufPair pair)protected voiddeallocate()static 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.ByteBufgetSecond()intreadableBytes()io.netty.util.ReferenceCountedtouch(java.lang.Object hint)
-
-
-
Field Detail
-
ENCODER
public static final ByteBufPair.Encoder ENCODER
-
COPYING_ENCODER
public static final ByteBufPair.CopyingEncoder COPYING_ENCODER
-
-
Method Detail
-
get
public static ByteBufPair get(io.netty.buffer.ByteBuf b1, io.netty.buffer.ByteBuf b2)
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
public static io.netty.buffer.ByteBuf coalesce(ByteBufPair pair)
- Returns:
- a single buffer with the content of both individual buffers
-
deallocate
protected void deallocate()
- Specified by:
deallocatein classio.netty.util.AbstractReferenceCounted
-
touch
public io.netty.util.ReferenceCounted touch(java.lang.Object hint)
-
-