Class AbstractMemoryIO
- Direct Known Subclasses:
AbstractArrayMemoryIO
,AbstractBufferMemoryIO
,BoundedMemoryIO
,InAccessibleMemoryIO
,ShareMemoryIO
,TransientNativeMemory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractMemoryIO
(Runtime runtime, long address, boolean isDirect) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkBounds
(long offset, long size) Checks that the memory region is within the bounds of this memory objectprotected static void
checkBounds
(long size, long off, long len) long
getAddress
(long offset) Reads a native memory address value at the given offset.long
Reads an integer value of the given type, at the given offset.long
getLong
(long offset) Reads along
(64 bit) value at the given offset.final long
getNativeLong
(long offset) Reads a nativelong
value at the given offset.int
indexOf
(long offset, byte value) Returns the location of a byte value within the memory area represented by thisPointer
.void
putAddress
(long offset, long value) Writes a native memory address value at the given offset.void
putAddress
(long offset, Address value) Writes a native memory address value at the given offset.void
Writes an integer of a specific type, at the given offset.void
putLong
(long offset, long value) Writes anative long
value at the given offset.void
putNativeLong
(long offset, long value) Writes a nativelong
value at the given offset.slice
(long offset) Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
.slice
(long offset, long size) Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
.void
transferFrom
(long offset, Pointer other, long otherOffset, long count) Bulk data transfer from one memory location to another.void
transferTo
(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:Pointer
Returns the location of a byte value within the memory area represented by thisPointer
.- Specified by:
indexOf
in classPointer
- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin searching.value
- thebyte
value 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:Pointer
Reads 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:
getAddress
in classPointer
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents 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:Pointer
Writes 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:
putAddress
in classPointer
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents 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:Pointer
Checks that the memory region is within the bounds of this memory object- Specified by:
checkBounds
in classPointer
- Parameters:
offset
- the starting point within this memory region.size
- the length of the memory region in bytes
-
putAddress
Description copied from class:Pointer
Writes 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:
putAddress
in classPointer
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents 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:Pointer
Reads a nativelong
value at the given offset.A native
long
can 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:
getNativeLong
in classPointer
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be read.- Returns:
- the native
long
value at the offset. - See Also:
-
putNativeLong
public void putNativeLong(long offset, long value) Description copied from class:Pointer
Writes a nativelong
value at the given offset.A native
long
can 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:
putNativeLong
in classPointer
- Parameters:
offset
- The offset from the start of the memory thisPointer
represents at which the value will be written.value
- the nativelong
value to be written.
-
getLong
public long getLong(long offset) Description copied from class:Pointer
Reads along
(64 bit) value at the given offset. -
putLong
public void putLong(long offset, long value) Description copied from class:Pointer
Writes anative long
value at the given offset. -
putInt
Description copied from class:Pointer
Writes an integer of a specific type, at the given offset. -
getInt
Description copied from class:Pointer
Reads an integer value of the given type, at the given offset. -
slice
Description copied from class:Pointer
Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
. -
slice
Description copied from class:Pointer
Creates a newPointer
representing a sub-region of the memory referred to by thisPointer
. -
transferTo
Description copied from class:Pointer
Bulk data transfer from one memory location to another.- Specified by:
transferTo
in classPointer
- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin copying from.other
- the destination memory location to transfer data to.otherOffset
- the offset from the start of the memory location the destinationPointer
represents to begin copying to.count
- the number of bytes to transfer.
-
transferFrom
Description copied from class:Pointer
Bulk data transfer from one memory location to another.- Specified by:
transferFrom
in classPointer
- Parameters:
offset
- the offset from the start of the memory location thisPointer
represents to begin copying to.other
- the destination memory location to transfer data from.otherOffset
- the offset from the start of the memory location the destinationPointer
represents to begin copying from.count
- the number of bytes to transfer.
-