Top Fields Constructors Methods
jnr.ffi.provider

public abstract Class AbstractBufferMemoryIO

extends AbstractMemoryIO
Class Inheritance
Known Direct Subclasses
jnr.ffi.provider.jffi.ByteBufferMemoryIO
Imports
jnr.ffi.Runtime, jnr.ffi.util.BufferUtil, java.nio.ByteBuffer, java.nio.charset.Charset

Field Summary

Modifier and TypeField and Description
protected final ByteBuffer

Constructor Summary

AccessConstructor and Description
public
AbstractBufferMemoryIO(Runtime runtime, ByteBuffer buffer, long address)

Method Summary

Modifier and TypeMethod and Description
public Object
array()

Implements abstract jnr.ffi.Pointer.array.

Returns the array that backs this pointer.
public int
arrayLength()

Implements abstract jnr.ffi.Pointer.arrayLength.

Returns the length of this pointer's backing array that is used by this pointer.
public int
arrayOffset()

Implements abstract jnr.ffi.Pointer.arrayOffset.

Returns the offset within this pointer's backing array of the first element.
public void
get(long
the offset from the start of the memory this Pointer represents at which the first value will be read.
offset
,
byte[]
the array into which values are to be stored.
dst
,
int
the start index in the dst array to begin storing the values.
off
,
int
the number of values to be read.
len
)

Implements abstract jnr.ffi.Pointer.get.

Bulk get method for multiple byte values.
public void
get(long
The offset from the start of the memory this Pointer represents at which the first value will be read.
offset
,
short[]
The array into which values are to be stored.
dst
,
int
the start index in the dst array to begin storing the values.
off
,
int
the number of values to be read.
len
)

Implements abstract jnr.ffi.Pointer.get.

Bulk get method for multiple short values.
public void
get(long
The offset from the start of the memory this Pointer represents at which the first value will be read.
offset
,
int[]
The array into which values are to be stored.
dst
,
int
the start index in the dst array to begin storing the values.
off
,
int
the number of values to be read.
len
)

Implements abstract jnr.ffi.Pointer.get.

Bulk get method for multiple int values.
public void
get(long
The offset from the start of the memory this Pointer represents at which the first value will be read.
offset
,
long[]
The array into which values are to be stored.
dst
,
int
the start index in the dst array to begin storing the values.
off
,
int
the number of values to be read.
len
)

Implements abstract jnr.ffi.Pointer.get.

Bulk get method for multiple long values.
public void
get(long
The offset from the start of the memory this Pointer represents at which the first value will be read.
offset
,
float[]
The array into which values are to be stored.
dst
,
int
the start index in the dst array to begin storing the values.
off
,
int
the number of values to be read.
len
)

Implements abstract jnr.ffi.Pointer.get.

Bulk get method for multiple float values.
public void
get(long
The offset from the start of the memory this Pointer represents at which the first value will be read.
offset
,
double[]
The array into which values are to be stored.
dst
,
int
the start index in the dst array to begin storing the values.
off
,
int
the number of values to be read.
len
)

Implements abstract jnr.ffi.Pointer.get.

Bulk get method for multiple double values.
public byte
getByte(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.getByte.

Reads an byte (8 bit) value at the given offset.
public final ByteBuffer
public double
getDouble(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.getDouble.

Reads a double (64 bit) value at the given offset.
public float
getFloat(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.getFloat.

Reads a float (32 bit) value at the given offset.
public int
getInt(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 int (32 bit) value at the given offset.
public long
getLongLong(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.getLongLong.

Reads a long (64 bit) value at the given offset.
public short
getShort(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.getShort.

Reads a short (16 bit) value at the given offset.
public String
getString(long offset, int size)

public String
getString(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.getString.

Reads an String value at the given offset.
public String
getString(long
the offset from the start of the memory this Pointer represents at which the value will be read.
offset
,
int
the maximum size of memory to search for a NUL byte.
maxLength
,
Charset
the Charset to use to decode the string.
cs
)

Implements abstract jnr.ffi.Pointer.getString.

Reads a String value at the given offset, using a specific Charset
public boolean
hasArray()

Implements abstract jnr.ffi.Pointer.hasArray.

Indicates whether this Pointer instance is backed by an array.
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
,
int
the maximum number of bytes to search for the desired value.
maxlen
)

Implements abstract jnr.ffi.Pointer.indexOf.

Returns the location of a byte value within the memory area represented by this Pointer.
public void
put(long
the offset from the start of the memory this Pointer represents at which the first value will be written.
offset
,
byte[]
the array to get values from.
dst
,
int
the start index in the dst array to begin reading values.
off
,
int
the number of values to be written.
len
)

Implements abstract jnr.ffi.Pointer.put.

Bulk put method for multiple byte values.
public void
put(long
the offset from the start of the memory this Pointer represents at which the first value will be written.
offset
,
short[]
the array to get values from.
dst
,
int
the start index in the dst array to begin reading values.
off
,
int
the number of values to be written.
len
)

Implements abstract jnr.ffi.Pointer.put.

Bulk put method for multiple short values.
public void
put(long
the offset from the start of the memory this Pointer represents at which the first value will be written.
offset
,
int[]
the array to get values from.
src
,
int
the start index in the dst array to begin reading values.
off
,
int
the number of values to be written.
len
)

Implements abstract jnr.ffi.Pointer.put.

Bulk put method for multiple int values.
public void
put(long
the offset from the start of the memory this Pointer represents at which the first value will be written.
offset
,
long[]
the array to get values from.
src
,
int
the start index in the dst array to begin reading values.
off
,
int
the number of values to be written.
len
)

Implements abstract jnr.ffi.Pointer.put.

Bulk put method for multiple long values.
public void
put(long
the offset from the start of the memory this Pointer represents at which the first value will be written.
offset
,
float[]
the array to get values from.
src
,
int
the start index in the dst array to begin reading values.
off
,
int
the number of values to be written.
len
)

Implements abstract jnr.ffi.Pointer.put.

Bulk put method for multiple float values.
public void
put(long
the offset from the start of the memory this Pointer represents at which the first value will be written.
offset
,
double[]
the array to get values from.
src
,
int
the start index in the dst array to begin reading values.
off
,
int
the number of values to be written.
len
)

Implements abstract jnr.ffi.Pointer.put.

Bulk put method for multiple double values.
public void
putByte(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
byte
the byte value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putByte.

Writes a byte (8 bit) value at the given offset.
public void
putDouble(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
double
the double value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putDouble.

Writes a double (64 bit, double precision) value at the given offset.
public void
putFloat(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
float
the float value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putFloat.

Writes a float (32 bit, single precision) value at the given offset.
public void
putInt(long
The offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
int
the int value to be written.
value
)

Implements abstract jnr.ffi.Pointer.putInt.

Writes an int (32 bit) value at the given offset.
public void
putLongLong(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.putLongLong.

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

Implements abstract jnr.ffi.Pointer.putShort.

Writes a short (16 bit) value at the given offset.
public void
putString(long offset, String string)

public void
putString(long
the offset from the start of the memory this Pointer represents at which the value will be written.
offset
,
String
the string to be written.
string
,
int
the maximum size of memory to use to store the string.
maxLength
,
Charset
the Charset to use to decode the string.
cs
)

Implements abstract jnr.ffi.Pointer.putString.

Writes a String value at the given offset, using a specific Charset
public void
setMemory(long
the offset from the start of the memory location this Pointer represents to begin writing to.
offset
,
long
the number of bytes to set to the value.
size
,
byte
the value to set each byte to.
value
)

Implements abstract jnr.ffi.Pointer.setMemory.

Sets the value of each byte in the memory area represented by this Pointer.
public long
size()

Implements abstract jnr.ffi.Pointer.size.

Gets the size of this memory object in bytes (optional operation).
Inherited from jnr.ffi.provider.AbstractMemoryIO:
checkBoundscheckBoundsgetAddressgetIntgetLonggetNativeLongindexOfputAddressputAddressputIntputLongputNativeLongsliceslicetransferFromtransferTo

Field Detail

bufferback to summary
protected final ByteBuffer buffer

Constructor Detail

AbstractBufferMemoryIOback to summary
public AbstractBufferMemoryIO(Runtime runtime, ByteBuffer buffer, long address)

Method Detail

arrayback to summary
public Object array()

Implements abstract jnr.ffi.Pointer.array.

Doc from jnr.ffi.Pointer.array.

Returns the array that backs this pointer.

Returns:Object

The array that backs this pointer.

Annotations
@Override
arrayLengthback to summary
public int arrayLength()

Implements abstract jnr.ffi.Pointer.arrayLength.

Doc from jnr.ffi.Pointer.arrayLength.

Returns the length of this pointer's backing array that is used by this pointer.

Returns:int

The length of the backing array used

Annotations
@Override
arrayOffsetback to summary
public int arrayOffset()

Implements abstract jnr.ffi.Pointer.arrayOffset.

Doc from jnr.ffi.Pointer.arrayOffset.

Returns the offset within this pointer's backing array of the first element.

Returns:int

The offset of the first element on the backing array

Annotations
@Override
getback to summary
public void get(long offset, byte[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.get.

Doc from jnr.ffi.Pointer.get.

Bulk get method for multiple byte values. This method reads multiple byte values from consecutive addresses, beginning at the given offset, and stores them in an array.

Parameters
offset:long

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

dst:byte[]

the array into which values are to be stored.

off:int

the start index in the dst array to begin storing the values.

len:int

the number of values to be read.

Annotations
@Override
getback to summary
public void get(long offset, short[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.get.

Doc from jnr.ffi.Pointer.get.

Bulk get method for multiple short values. This method reads multiple short values from consecutive addresses, beginning at the given offset, and stores them in an array.

Parameters
offset:long

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

dst:short[]

The array into which values are to be stored.

off:int

the start index in the dst array to begin storing the values.

len:int

the number of values to be read.

Annotations
@Override
getback to summary
public void get(long offset, int[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.get.

Doc from jnr.ffi.Pointer.get.

Bulk get method for multiple int values. This method reads multiple int values from consecutive addresses, beginning at the given offset, and stores them in an array.

Parameters
offset:long

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

dst:int[]

The array into which values are to be stored.

off:int

the start index in the dst array to begin storing the values.

len:int

the number of values to be read.

Annotations
@Override
getback to summary
public void get(long offset, long[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.get.

Doc from jnr.ffi.Pointer.get.

Bulk get method for multiple long values. This method reads multiple long values from consecutive addresses, beginning at the given offset, and stores them in an array.

Parameters
offset:long

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

dst:long[]

The array into which values are to be stored.

off:int

the start index in the dst array to begin storing the values.

len:int

the number of values to be read.

Annotations
@Override
getback to summary
public void get(long offset, float[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.get.

Doc from jnr.ffi.Pointer.get.

Bulk get method for multiple float values. This method reads multiple float values from consecutive addresses, beginning at the given offset, and stores them in an array.

Parameters
offset:long

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

dst:float[]

The array into which values are to be stored.

off:int

the start index in the dst array to begin storing the values.

len:int

the number of values to be read.

Annotations
@Override
getback to summary
public void get(long offset, double[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.get.

Doc from jnr.ffi.Pointer.get.

Bulk get method for multiple double values. This method reads multiple double values from consecutive addresses, beginning at the given offset, and stores them in an array.

Parameters
offset:long

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

dst:double[]

The array into which values are to be stored.

off:int

the start index in the dst array to begin storing the values.

len:int

the number of values to be read.

Annotations
@Override
getByteback to summary
public byte getByte(long offset)

Implements abstract jnr.ffi.Pointer.getByte.

Doc from jnr.ffi.Pointer.getByte.

Reads an byte (8 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:byte

the byte value at the offset.

getByteBufferback to summary
public final ByteBuffer getByteBuffer()
getDoubleback to summary
public double getDouble(long offset)

Implements abstract jnr.ffi.Pointer.getDouble.

Doc from jnr.ffi.Pointer.getDouble.

Reads a double (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:double

the double value at the offset.

getFloatback to summary
public float getFloat(long offset)

Implements abstract jnr.ffi.Pointer.getFloat.

Doc from jnr.ffi.Pointer.getFloat.

Reads a float (32 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:float

the float value at the offset.

getIntback to summary
public int getInt(long offset)

Implements abstract jnr.ffi.Pointer.getInt.

Doc from jnr.ffi.Pointer.getInt.

Reads an int (32 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:int

the int value contained in the memory at the offset.

getLongLongback to summary
public long getLongLong(long offset)

Implements abstract jnr.ffi.Pointer.getLongLong.

Doc from jnr.ffi.Pointer.getLongLong.

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.

getShortback to summary
public short getShort(long offset)

Implements abstract jnr.ffi.Pointer.getShort.

Doc from jnr.ffi.Pointer.getShort.

Reads a short (16 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:short

the short value at the offset.

getStringback to summary
public String getString(long offset, int size)
getStringback to summary
public String getString(long offset)

Implements abstract jnr.ffi.Pointer.getString.

Doc from jnr.ffi.Pointer.getString.

Reads an String 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:String

the String value read from memory.

Annotations
@Override
getStringback to summary
public String getString(long offset, int maxLength, Charset cs)

Implements abstract jnr.ffi.Pointer.getString.

Doc from jnr.ffi.Pointer.getString.

Reads a String value at the given offset, using a specific Charset

Parameters
offset:long

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

maxLength:int

the maximum size of memory to search for a NUL byte.

cs:Charset

the Charset to use to decode the string.

Returns:String

the String value read from memory.

Annotations
@Override
hasArrayback to summary
public boolean hasArray()

Implements abstract jnr.ffi.Pointer.hasArray.

Doc from jnr.ffi.Pointer.hasArray.

Indicates whether this Pointer instance is backed by an array.

Returns:boolean

true if, and only if, this memory object is backed by an array

Annotations
@Override
indexOfback to summary
public int indexOf(long offset, byte value, int maxlen)

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.

maxlen:int

the maximum number of bytes to search for the desired value.

Returns:int

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

Annotations
@Override
putback to summary
public void put(long offset, byte[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.put.

Doc from jnr.ffi.Pointer.put.

Bulk put method for multiple byte values. This method writes multiple byte values to consecutive addresses, beginning at the given offset, from an array.

Parameters
offset:long

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

dst:byte[]

the array to get values from.

off:int

the start index in the dst array to begin reading values.

len:int

the number of values to be written.

Annotations
@Override
putback to summary
public void put(long offset, short[] dst, int off, int len)

Implements abstract jnr.ffi.Pointer.put.

Doc from jnr.ffi.Pointer.put.

Bulk put method for multiple short values. This method writes multiple short values to consecutive addresses, beginning at the given offset, from an array.

Parameters
offset:long

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

dst:short[]

the array to get values from.

off:int

the start index in the dst array to begin reading values.

len:int

the number of values to be written.

Annotations
@Override
putback to summary
public void put(long offset, int[] src, int off, int len)

Implements abstract jnr.ffi.Pointer.put.

Doc from jnr.ffi.Pointer.put.

Bulk put method for multiple int values. This method writes multiple int values to consecutive addresses, beginning at the given offset, from an array.

Parameters
offset:long

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

src:int[]

the array to get values from.

off:int

the start index in the dst array to begin reading values.

len:int

the number of values to be written.

Annotations
@Override
putback to summary
public void put(long offset, long[] src, int off, int len)

Implements abstract jnr.ffi.Pointer.put.

Doc from jnr.ffi.Pointer.put.

Bulk put method for multiple long values. This method writes multiple long values to consecutive addresses, beginning at the given offset, from an array.

Parameters
offset:long

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

src:long[]

the array to get values from.

off:int

the start index in the dst array to begin reading values.

len:int

the number of values to be written.

Annotations
@Override
putback to summary
public void put(long offset, float[] src, int off, int len)

Implements abstract jnr.ffi.Pointer.put.

Doc from jnr.ffi.Pointer.put.

Bulk put method for multiple float values. This method writes multiple float values to consecutive addresses, beginning at the given offset, from an array.

Parameters
offset:long

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

src:float[]

the array to get values from.

off:int

the start index in the dst array to begin reading values.

len:int

the number of values to be written.

Annotations
@Override
putback to summary
public void put(long offset, double[] src, int off, int len)

Implements abstract jnr.ffi.Pointer.put.

Doc from jnr.ffi.Pointer.put.

Bulk put method for multiple double values. This method writes multiple double values to consecutive addresses, beginning at the given offset, from an array.

Parameters
offset:long

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

src:double[]

the array to get values from.

off:int

the start index in the dst array to begin reading values.

len:int

the number of values to be written.

Annotations
@Override
putByteback to summary
public void putByte(long offset, byte value)

Implements abstract jnr.ffi.Pointer.putByte.

Doc from jnr.ffi.Pointer.putByte.

Writes a byte (8 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 written.

value:byte

the byte value to be written.

putDoubleback to summary
public void putDouble(long offset, double value)

Implements abstract jnr.ffi.Pointer.putDouble.

Doc from jnr.ffi.Pointer.putDouble.

Writes a double (64 bit, double precision) 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:double

the double value to be written.

putFloatback to summary
public void putFloat(long offset, float value)

Implements abstract jnr.ffi.Pointer.putFloat.

Doc from jnr.ffi.Pointer.putFloat.

Writes a float (32 bit, single precision) 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:float

the float value to be written.

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

Implements abstract jnr.ffi.Pointer.putInt.

Doc from jnr.ffi.Pointer.putInt.

Writes an int (32 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 written.

value:int

the int value to be written.

putLongLongback to summary
public void putLongLong(long offset, long value)

Implements abstract jnr.ffi.Pointer.putLongLong.

Doc from jnr.ffi.Pointer.putLongLong.

Writes 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 written.

value:long

the long value to be written.

putShortback to summary
public void putShort(long offset, short value)

Implements abstract jnr.ffi.Pointer.putShort.

Doc from jnr.ffi.Pointer.putShort.

Writes a short (16 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 written.

value:short

the short value to be written.

putStringback to summary
public void putString(long offset, String string)
putStringback to summary
public void putString(long offset, String string, int maxLength, Charset cs)

Implements abstract jnr.ffi.Pointer.putString.

Doc from jnr.ffi.Pointer.putString.

Writes a String value at the given offset, using a specific Charset

Parameters
offset:long

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

string:String

the string to be written.

maxLength:int

the maximum size of memory to use to store the string.

cs:Charset

the Charset to use to decode the string.

Annotations
@Override
setMemoryback to summary
public void setMemory(long offset, long size, byte value)

Implements abstract jnr.ffi.Pointer.setMemory.

Doc from jnr.ffi.Pointer.setMemory.

Sets the value of each byte in the memory area represented by this Pointer. to a specified value.

Parameters
offset:long

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

size:long

the number of bytes to set to the value.

value:byte

the value to set each byte to.

Annotations
@Override
sizeback to summary
public long size()

Implements abstract jnr.ffi.Pointer.size.

Doc from jnr.ffi.Pointer.size.

Gets the size of this memory object in bytes (optional operation).

Returns:long

the size of the memory area this Pointer points to. If the size is unknown, java.lang.Long#MAX_VALUE is returned}.