Interface ByteBufferManager

All Known Implementing Classes:
AbstractBufferManager, MappedBufferManager

public interface ByteBufferManager
An interface for managing a ByteBuffer.
Since:
Coherence 2.2
Author:
cp 2002.09.16
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the current ByteBuffer reference.
    int
    Get the capacity of the current ByteBuffer.
    int
    Determine the level (what number of bytes used) above which the current ByteBuffer will need to be "resized" upwards.
    int
    Determine the maximum size that the managed buffer can reach.
    int
    Determine the minimum size that the managed buffer can reach.
    int
    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 Details

    • 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