IGuardablePtr

public interface IGuardablePtr<T>

Interface for pointer objects that can be converted to guarded pointer objects.

Methods

getGuardHigh

public int getGuardHigh()

Returns the guarded pointer’s high endpoint (exclusive). Calling this method on a non-guarded pointer will result in an UnsupportedOperationException exception!

Returns:the guarded pointer’s high endpoint (exclusive)

getGuardLow

public int getGuardLow()

Returns the guarded pointer’s low endpoint (inclusive). Calling this method on a non-guarded pointer will result in an UnsupportedOperationException exception!

Returns:the guarded pointer’s low endpoint (inclusive)

getGuarded

public T getGuarded(int length)

Returns the guarded version of this pointer. This call is equivalent to getGuarded(0, length).

Parameters:
  • length – number of elements to enable access to
Returns:

guarded version of this pointer

getGuarded

public T getGuarded(int fromIndex, int toIndex)

Returns the guarded version of this pointer.

Parameters:
  • fromIndex – low endpoint (inclusive) of the pointer
  • toIndex – high endpoint (exclusive) of the pointer
Returns:

guarded version of this pointer

isGuarded

public boolean isGuarded()

Returns true if this pointer’s read/write methods are index guarded. When a pointer is guarded, the index parameter of read/write calls is checked. Accessing elements which are out of bounds will result in an IndexOutOfBoundsException exception.

Returns:true if this pointer’s read/write methods are index guarded