Top Description Constructors Methods
jnr.ffi.provider

public abstract Class AbstractMemoryIO

extends Pointer
Class Inheritance
Known Direct Subclasses
jnr.ffi.provider.BoundedMemoryIO, jnr.ffi.provider.InAccessibleMemoryIO, jnr.ffi.provider.ShareMemoryIO, jnr.ffi.provider.jffi.DirectMemoryIO, jnr.ffi.provider.AbstractArrayMemoryIO, jnr.ffi.provider.AbstractBufferMemoryIO
Imports
jnr.ffi.Address, .Pointer, .Runtime, .Type, java.nio.ByteBuffer

Base implementations of some MemoryIO operations.

Constructor Summary

AccessConstructor and Description
protected
AbstractMemoryIO(Runtime runtime, long address, boolean isDirect)

Method Summary

Modifier and TypeMethod and Description
protected static void
checkBounds(long size, long off, long len)

public void
checkBounds(long
the starting point within this memory region.
offset
,
long
the length of the memory region in bytes
size
)

Implements abstract jnr.ffi.Pointer.checkBounds.

Checks that the memory region is within the bounds of this memory object
public long
getAddress(long
The offset from the start of the memory this Pointer represents at which the value will be read.
offset
)

Implements abstract jnr.ffi.Pointer.getAddress.

Reads a native memory address value at the given offset.
public long
getInt(Type
Type of integer to read.
type
,
long
The offset from the start of the memory this Pointer represents at which the value will be read.
offset
)

Implements abstract jnr.ffi.Pointer.getInt.

Reads an integer value of the given type, at the given offset.
public long
getLong(long
The offset from the start of the memory this Pointer represents at which the value will be read.
offset
)

Implements abstract jnr.ffi.Pointer.getLong.

Reads a long (64 bit) value at the given offset.
public final long
getNativeLong(long
The offset from the start of the memory this Pointer represents at which the value will be read.
offset
)

Implements abstract jnr.ffi.Pointer.getNativeLong.

Reads a native long value at the given offset.
public int
indexOf(long
the offset from the start of the memory location this Pointer represents to begin searching.
offset
,
byte
the byte value to locate.
value
)

Implements abstract jnr.ffi.Pointer.indexOf.

Returns the location of a byte value within the memory area represented by this Pointer.
public void
putAddress(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
long
The native address value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putAddress.

Writes a native memory address value at the given offset.
public void
putAddress(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
Address
The native address value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putAddress.

Writes a native memory address value at the given offset.
public void
putInt(Type
The integer type.
type
,
long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
long
the int value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putInt.

Writes an integer of a specific type, at the given offset.
public void
putLong(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
long
the long value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putLong.

Writes a native long value at the given offset.
public void
putNativeLong(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
long
the native long value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putNativeLong.

Writes a native long value at the given offset.
public AbstractMemoryIO
slice(long
the offset from the start of the memory this Pointer represents at which the new Pointer will start.
offset
)

Implements abstract jnr.ffi.Pointer.slice.

Creates a new Pointer representing a sub-region of the memory referred to by this Pointer.
public AbstractMemoryIO
slice(long
the offset from the start of the memory this Pointer represents at which the new Pointer will start.
offset
,
long
the maximum size of the memory sub-region.
size
)

Implements abstract jnr.ffi.Pointer.slice.

Creates a new Pointer representing a sub-region of the memory referred to by this Pointer.
public void
transferFrom(long
the offset from the start of the memory location this Pointer represents to begin copying to.
offset
,
Pointer
the destination memory location to transfer data from.
other
,
long
the offset from the start of the memory location the destination Pointer represents to begin copying from.
otherOffset
,
long
the number of bytes to transfer.
count
)

Implements abstract jnr.ffi.Pointer.transferFrom.

Bulk data transfer from one memory location to another.
public void
transferTo(long
the offset from the start of the memory location this Pointer represents to begin copying from.
offset
,
Pointer
the destination memory location to transfer data to.
other
,
long
the offset from the start of the memory location the destination Pointer represents to begin copying to.
otherOffset
,
long
the number of bytes to transfer.
count
)

Implements abstract jnr.ffi.Pointer.transferTo.

Bulk data transfer from one memory location to another.
Inherited from jnr.ffi.Pointer:
addressarrayarrayLengtharrayOffsetgetgetgetgetgetgetgetgetBytegetDoublegetFloatgetIntgetLongLonggetNullTerminatedPointerArraygetNullTerminatedStringArraygetPointergetPointergetRuntimegetShortgetStringgetStringhasArrayindexOfisDirectnewIntPointerputputputputputputputputByteputDoubleputFloatputIntputLongLongputPointerputShortputStringsetMemorysizetoStringwrapwrapwrap

Constructor Detail

AbstractMemoryIOback to summary
protected AbstractMemoryIO(Runtime runtime, long address, boolean isDirect)

Method Detail

checkBoundsback to summary
protected static void checkBounds(long size, long off, long len)
checkBoundsback to summary
public void checkBounds(long offset, long size)

Implements abstract jnr.ffi.Pointer.checkBounds.

Doc from jnr.ffi.Pointer.checkBounds.

Checks that the memory region is within the bounds of this memory object

Parameters
offset:long

the starting point within this memory region.

size:long

the length of the memory region in bytes

getAddressback to summary
public long getAddress(long offset)

Implements abstract jnr.ffi.Pointer.getAddress.

Doc from jnr.ffi.Pointer.getAddress.

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.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be read.

Returns:long

the native address value contained in the memory at the offset

getIntback to summary
public long getInt(Type type, long offset)

Implements abstract jnr.ffi.Pointer.getInt.

Doc from jnr.ffi.Pointer.getInt.

Reads an integer value of the given type, at the given offset.

Parameters
type:Type

Type of integer to read.

offset:long

The offset from the start of the memory this Pointer represents at which the value will be read.

Returns:long

the int value contained in the memory at the offset.

Annotations
@Override
getLongback to summary
public long getLong(long offset)

Implements abstract jnr.ffi.Pointer.getLong.

Doc from jnr.ffi.Pointer.getLong.

Reads a long (64 bit) value at the given offset.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be read.

Returns:long

the long value at the offset.

getNativeLongback to summary
public final long getNativeLong(long offset)

Implements abstract jnr.ffi.Pointer.getNativeLong.

Doc from jnr.ffi.Pointer.getNativeLong.

Reads a native long 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.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be read.

Returns:long

the native long value at the offset.

indexOfback to summary
public int indexOf(long offset, byte value)

Implements abstract jnr.ffi.Pointer.indexOf.

Doc from jnr.ffi.Pointer.indexOf.

Returns the location of a byte value within the memory area represented by this Pointer.

Parameters
offset:long

the offset from the start of the memory location this Pointer represents to begin searching.

value:byte

the byte value to locate.

Returns:int

the offset from the start of the search area (i.e. relative to the offset parameter), or -1 if not found.

putAddressback to summary
public void putAddress(long offset, long value)

Implements abstract jnr.ffi.Pointer.putAddress.

Doc from jnr.ffi.Pointer.putAddress.

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.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be written.

value:long

The native address value to be written.

putAddressback to summary
public void putAddress(long offset, Address value)

Implements abstract jnr.ffi.Pointer.putAddress.

Doc from jnr.ffi.Pointer.putAddress.

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.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be written.

value:Address

The native address value to be written.

putIntback to summary
public void putInt(Type type, long offset, long value)

Implements abstract jnr.ffi.Pointer.putInt.

Doc from jnr.ffi.Pointer.putInt.

Writes an integer of a specific type, at the given offset.

Parameters
type:Type

The integer type.

offset:long

The offset from the start of the memory this Pointer represents at which the value will be written.

value:long

the int value to be written.

Annotations
@Override
putLongback to summary
public void putLong(long offset, long value)

Implements abstract jnr.ffi.Pointer.putLong.

Doc from jnr.ffi.Pointer.putLong.

Writes a native long value at the given offset.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be written.

value:long

the long value to be written.

putNativeLongback to summary
public void putNativeLong(long offset, long value)

Implements abstract jnr.ffi.Pointer.putNativeLong.

Doc from jnr.ffi.Pointer.putNativeLong.

Writes a native long 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.

Parameters
offset:long

The offset from the start of the memory this Pointer represents at which the value will be written.

value:long

the native long value to be written.

sliceback to summary
public AbstractMemoryIO slice(long offset)

Implements abstract jnr.ffi.Pointer.slice.

Doc from jnr.ffi.Pointer.slice.

Creates a new Pointer representing a sub-region of the memory referred to by this Pointer.

Parameters
offset:long

the offset from the start of the memory this Pointer represents at which the new Pointer will start.

Returns:AbstractMemoryIO

a Pointer instance representing the new sub-region.

sliceback to summary
public AbstractMemoryIO slice(long offset, long size)

Implements abstract jnr.ffi.Pointer.slice.

Doc from jnr.ffi.Pointer.slice.

Creates a new Pointer representing a sub-region of the memory referred to by this Pointer.

Parameters
offset:long

the offset from the start of the memory this Pointer represents at which the new Pointer will start.

size:long

the maximum size of the memory sub-region.

Returns:AbstractMemoryIO

a Pointer instance representing the new sub-region.

transferFromback to summary
public void transferFrom(long offset, Pointer other, long otherOffset, long count)

Implements abstract jnr.ffi.Pointer.transferFrom.

Doc from jnr.ffi.Pointer.transferFrom.

Bulk data transfer from one memory location to another.

Parameters
offset:long

the offset from the start of the memory location this Pointer represents to begin copying to.

other:Pointer

the destination memory location to transfer data from.

otherOffset:long

the offset from the start of the memory location the destination Pointer represents to begin copying from.

count:long

the number of bytes to transfer.

transferToback to summary
public void transferTo(long offset, Pointer other, long otherOffset, long count)

Implements abstract jnr.ffi.Pointer.transferTo.

Doc from jnr.ffi.Pointer.transferTo.

Bulk data transfer from one memory location to another.

Parameters
offset:long

the offset from the start of the memory location this Pointer represents to begin copying from.

other:Pointer

the destination memory location to transfer data to.

otherOffset:long

the offset from the start of the memory location the destination Pointer represents to begin copying to.

count:long

the number of bytes to transfer.