Class AbstractByteBufPool<T>

    • Field Detail

    • Constructor Detail

      • AbstractByteBufPool

        public AbstractByteBufPool()
      • AbstractByteBufPool

        public AbstractByteBufPool​(int capacity)
    • Method Detail

      • canPool

        protected abstract boolean canPool​(io.netty.buffer.ByteBuf byteBuf,
                                           int length)
        Returns true if length's byteBuf content from ByteBuf.readerIndex() can be pooled, false otherwise.
      • create

        protected abstract T create​(io.netty.buffer.ByteBuf byteBuf,
                                    int length)
        Create a new entry.
      • isEqual

        protected abstract boolean isEqual​(T entry,
                                           io.netty.buffer.ByteBuf byteBuf,
                                           int offset,
                                           int length)
        Returns true if the entry content is the same of byteBuf at the specified offset and length false otherwise.
      • getOrCreate

        public final T getOrCreate​(io.netty.buffer.ByteBuf byteBuf)
        Returns a pooled entry if possible, a new one otherwise.

        The byteBuf's ByteBuf.readerIndex() is incremented by length after it.