Class AbstractMemoryIO
- Direct Known Subclasses:
AbstractArrayMemoryIO,AbstractBufferMemoryIO,BoundedMemoryIO,InAccessibleMemoryIO,ShareMemoryIO,TransientNativeMemory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMemoryIO(Runtime runtime, long address, boolean isDirect) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckBounds(long offset, long size) Checks that the memory region is within the bounds of this memory objectprotected static voidcheckBounds(long size, long off, long len) longgetAddress(long offset) Reads a native memory address value at the given offset.longReads an integer value of the given type, at the given offset.longgetLong(long offset) Reads along(64 bit) value at the given offset.final longgetNativeLong(long offset) Reads a nativelongvalue at the given offset.intindexOf(long offset, byte value) Returns the location of a byte value within the memory area represented by thisPointer.voidputAddress(long offset, long value) Writes a native memory address value at the given offset.voidputAddress(long offset, Address value) Writes a native memory address value at the given offset.voidWrites an integer of a specific type, at the given offset.voidputLong(long offset, long value) Writes anative longvalue at the given offset.voidputNativeLong(long offset, long value) Writes a nativelongvalue at the given offset.slice(long offset) Creates a newPointerrepresenting a sub-region of the memory referred to by thisPointer.slice(long offset, long size) Creates a newPointerrepresenting a sub-region of the memory referred to by thisPointer.voidtransferFrom(long offset, Pointer other, long otherOffset, long count) Bulk data transfer from one memory location to another.voidtransferTo(long offset, Pointer other, long otherOffset, long count) Bulk data transfer from one memory location to another.Methods inherited from class jnr.ffi.Pointer
address, array, arrayLength, arrayOffset, get, get, get, get, get, get, get, getByte, getDouble, getFloat, getInt, getLongLong, getNullTerminatedPointerArray, getNullTerminatedStringArray, getPointer, getPointer, getRuntime, getShort, getString, getString, hasArray, indexOf, isDirect, newIntPointer, put, put, put, put, put, put, put, putByte, putDouble, putFloat, putInt, putLongLong, putPointer, putShort, putString, setMemory, size, toString, wrap, wrap, wrap
-
Constructor Details
-
AbstractMemoryIO
-
-
Method Details
-
checkBounds
protected static void checkBounds(long size, long off, long len) -
indexOf
public int indexOf(long offset, byte value) Description copied from class:PointerReturns the location of a byte value within the memory area represented by thisPointer.- Specified by:
indexOfin classPointer- Parameters:
offset- the offset from the start of the memory location thisPointerrepresents to begin searching.value- thebytevalue to locate.- Returns:
- the offset from the start of the search area (i.e. relative to the offset parameter), or -1 if not found.
-
getAddress
public long getAddress(long offset) Description copied from class:PointerReads a native memory address value at the given offset.A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
- Specified by:
getAddressin classPointer- Parameters:
offset- The offset from the start of the memory thisPointerrepresents at which the value will be read.- Returns:
- the native address value contained in the memory at the offset
- See Also:
-
putAddress
public void putAddress(long offset, long value) Description copied from class:PointerWrites a native memory address value at the given offset.A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
- Specified by:
putAddressin classPointer- Parameters:
offset- The offset from the start of the memory thisPointerrepresents at which the value will be written.value- The native address value to be written.- See Also:
-
checkBounds
public void checkBounds(long offset, long size) Description copied from class:PointerChecks that the memory region is within the bounds of this memory object- Specified by:
checkBoundsin classPointer- Parameters:
offset- the starting point within this memory region.size- the length of the memory region in bytes
-
putAddress
Description copied from class:PointerWrites a native memory address value at the given offset.A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
- Specified by:
putAddressin classPointer- Parameters:
offset- The offset from the start of the memory thisPointerrepresents at which the value will be written.value- The native address value to be written.- See Also:
-
getNativeLong
public final long getNativeLong(long offset) Description copied from class:PointerReads a nativelongvalue at the given offset.A native
longcan be either 32 or 64 bits in size, depending on the cpu architecture, and the C ABI in use.For windows, a long is always 32 bits (4 bytes) in size, but on unix systems, a long on a 32bit system is 32 bits, and on a 64bit system, is 64 bits.
- Specified by:
getNativeLongin classPointer- Parameters:
offset- The offset from the start of the memory thisPointerrepresents at which the value will be read.- Returns:
- the native
longvalue at the offset. - See Also:
-
putNativeLong
public void putNativeLong(long offset, long value) Description copied from class:PointerWrites a nativelongvalue at the given offset.A native
longcan be either 32 or 64 bits in size, depending on the cpu architecture, and the C ABI in use.For windows, a long is always 32 bits (4 bytes) in size, but on unix systems, a long on a 32bit system is 32 bits, and on a 64bit system, is 64 bits.
- Specified by:
putNativeLongin classPointer- Parameters:
offset- The offset from the start of the memory thisPointerrepresents at which the value will be written.value- the nativelongvalue to be written.
-
getLong
public long getLong(long offset) Description copied from class:PointerReads along(64 bit) value at the given offset. -
putLong
public void putLong(long offset, long value) Description copied from class:PointerWrites anative longvalue at the given offset. -
putInt
Description copied from class:PointerWrites an integer of a specific type, at the given offset. -
getInt
Description copied from class:PointerReads an integer value of the given type, at the given offset. -
slice
Description copied from class:PointerCreates a newPointerrepresenting a sub-region of the memory referred to by thisPointer. -
slice
Description copied from class:PointerCreates a newPointerrepresenting a sub-region of the memory referred to by thisPointer. -
transferTo
Description copied from class:PointerBulk data transfer from one memory location to another.- Specified by:
transferToin classPointer- Parameters:
offset- the offset from the start of the memory location thisPointerrepresents to begin copying from.other- the destination memory location to transfer data to.otherOffset- the offset from the start of the memory location the destinationPointerrepresents to begin copying to.count- the number of bytes to transfer.
-
transferFrom
Description copied from class:PointerBulk data transfer from one memory location to another.- Specified by:
transferFromin classPointer- Parameters:
offset- the offset from the start of the memory location thisPointerrepresents to begin copying to.other- the destination memory location to transfer data from.otherOffset- the offset from the start of the memory location the destinationPointerrepresents to begin copying from.count- the number of bytes to transfer.
-