Interface ByteBufferManager

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ByteBuffer getBuffer()
      Get the current ByteBuffer reference.
      int getCapacity()
      Get the capacity of the current ByteBuffer.
      int getGrowthThreshold()
      Determine the level (what number of bytes used) above which the current ByteBuffer will need to be "resized" upwards.
      int getMaxCapacity()
      Determine the maximum size that the managed buffer can reach.
      int getMinCapacity()
      Determine the minimum size that the managed buffer can reach.
      int getShrinkageThreshold()
      Determine the level (what number of bytes used) below which the current ByteBuffer will need to be "resized" downwards.
      void grow​(int cbRequired)
      Request that the buffer be grown based on the number of bytes currently required.
      void shrink​(int cbRequired)
      Request that the buffer be shrunk based on the number of bytes currently required.
    • Method Detail

      • getBuffer

        ByteBuffer getBuffer()
        Get the current ByteBuffer reference.
        Returns:
        the current ByteBuffer
      • getCapacity

        int getCapacity()
        Get the capacity of the current ByteBuffer. This is the same as getBuffer().capacity().
        Returns:
        the capacity of the current ByteBuffer
      • getGrowthThreshold

        int getGrowthThreshold()
        Determine the level (what number of bytes used) above which the current ByteBuffer will need to be "resized" upwards. Returns Integer.MAX_VALUE if the buffer cannot be resized upwards.
        Returns:
        the number of bytes that, when the number of used bytes exceeds it, the ByteBuffer will need to grow
      • getShrinkageThreshold

        int getShrinkageThreshold()
        Determine the level (what number of bytes used) below which the current ByteBuffer will need to be "resized" downwards. Returns 0 if the buffer cannot be resized downwards.
        Returns:
        the number of bytes that, when the number of used bytes drops below it, the ByteBuffer will need to shrink
      • getMinCapacity

        int getMinCapacity()
        Determine the minimum size that the managed buffer can reach. If the buffer is already at its minimum, then this method will return the same value as getCapacity.
        Returns:
        minimum size for the managed buffer
      • getMaxCapacity

        int getMaxCapacity()
        Determine the maximum size that the managed buffer can reach. If the buffer is already at its maximum, then this method will return the same value as getCapacity.
        Returns:
        maximum size for the managed buffer
      • grow

        void grow​(int cbRequired)
        Request that the buffer be grown based on the number of bytes currently required.
        Parameters:
        cbRequired - the number of bytes that are needed by the requesting operation
      • shrink

        void shrink​(int cbRequired)
        Request that the buffer be shrunk based on the number of bytes currently required.
        Parameters:
        cbRequired - the number of contiguous bytes in the buffer, starting from offset 0, that are actually in use