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.
  • Field Details

  • Method Details

    • get

      public static ByteBufPair get(io.netty.buffer.ByteBuf b1, io.netty.buffer.ByteBuf b2)
      Get a new ByteBufPair 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

      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:
      deallocate in class io.netty.util.AbstractReferenceCounted
    • touch

      public io.netty.util.ReferenceCounted touch(Object hint)