Class ArrayAccess

All Implemented Interfaces:
Serializable, AutoCloseable
Direct Known Subclasses:
DoubleMemoryArrayAccess, FloatMemoryArrayAccess, IntMemoryArrayAccess, LongMemoryArrayAccess

public abstract class ArrayAccess extends Object implements Serializable, AutoCloseable
The ArrayAccess class simulates a C language pointer. With one ArrayAccess object you can point to a location within an array. You can easily add or subtract a value to this "pointer", thus essentially emulating C pointer arithmetic. An ArrayAccess provides an array, the starting index within that array and the length of accessible data within the array, all in one convenient package.

Just like pointers in the C language, ArrayAccess objects are inherently unsafe and must be used cautiously. It is the responsibility of the user of an ArrayAccess object to make sure that he doesn't access the provided array outside the allowed range. The ArrayAccess object itself does nothing to enforce this, except of course the mandatory bounds check of Java, which can throw an ArrayIndexOutOfBoundsException.

Mikko Tommila
See Also: