Class IntBlockPool

  • public class IntBlockPool
    extends Object
    A pool for int blocks similar to ByteBlockPool
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Field Detail

      • buffers

        public int[][] buffers
        array of buffers currently used in the pool. Buffers are allocated if needed don't modify this outside of this class
      • intUpto

        public int intUpto
        Pointer to the current position in head buffer
      • buffer

        public int[] buffer
        Current head buffer
      • intOffset

        public int intOffset
        Current head offset
    • Method Detail

      • reset

        public void reset​(boolean zeroFillBuffers,
                          boolean reuseFirst)
        Expert: Resets the pool to its initial state, while optionally reusing the first buffer. Buffers that are not reused are reclaimed by ByteBlockPool.Allocator.recycleByteBlocks(byte[][], int, int). Buffers can be filled with zeros before recycling them. This is useful if a slice pool works on top of this int pool and relies on the buffers being filled with zeros to find the non-zero end of slices.
        zeroFillBuffers - if true the buffers are filled with 0.
        reuseFirst - if true the first buffer will be reused and calling nextBuffer() is not needed after reset iff the block pool was used before ie. nextBuffer() was called before.
      • nextBuffer

        public void nextBuffer()
        Advances the pool to its next buffer. This method should be called once after the constructor to initialize the pool. In contrast to the constructor a reset(boolean, boolean) call will advance the pool to its first buffer immediately.