|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjnr.ffi.Pointer
jnr.ffi.provider.AbstractMemoryIO
jnr.ffi.provider.ShareMemoryIO
public class ShareMemoryIO
| Constructor Summary | |
|---|---|
ShareMemoryIO(Pointer parent,
long offset)
|
|
| Method Summary | |
|---|---|
long |
address()
Gets the native address of this memory object (optional operation). |
java.lang.Object |
array()
|
int |
arrayLength()
|
int |
arrayOffset()
|
void |
get(long offset,
byte[] dst,
int off,
int len)
Bulk get method for multiple byte values. |
void |
get(long offset,
double[] dst,
int off,
int len)
Bulk get method for multiple double values. |
void |
get(long offset,
float[] dst,
int off,
int len)
Bulk get method for multiple float values. |
void |
get(long offset,
int[] dst,
int off,
int len)
Bulk get method for multiple int values. |
void |
get(long offset,
long[] dst,
int off,
int len)
Bulk get method for multiple long values. |
void |
get(long offset,
short[] dst,
int off,
int len)
Bulk get method for multiple short values. |
byte |
getByte(long offset)
Reads an byte (8 bit) value at the given offset. |
Pointer |
getDelegatedMemoryIO()
|
double |
getDouble(long offset)
Reads a double (64 bit) value at the given offset. |
float |
getFloat(long offset)
Reads a float (32 bit) value at the given offset. |
int |
getInt(long offset)
Reads an int (32 bit) value at the given offset. |
long |
getLong(long offset)
Reads a long (64 bit) value at the given offset. |
long |
getLongLong(long offset)
Reads a long (64 bit) value at the given offset. |
Pointer |
getPointer(long offset)
Reads an Pointer value at the given offset. |
Pointer |
getPointer(long offset,
long size)
Reads an Pointer value at the given offset. |
short |
getShort(long offset)
Reads a short (16 bit) value at the given offset. |
java.lang.String |
getString(long offset)
Reads an String value at the given offset. |
java.lang.String |
getString(long offset,
int maxLength,
java.nio.charset.Charset cs)
Reads a String value at the given offset, using a specific Charset |
boolean |
hasArray()
|
int |
indexOf(long offset,
byte value,
int maxlen)
Returns the location of a byte value within the memory area represented by this Pointer. |
boolean |
isDirect()
Indicates whether or not this memory object represents a native memory address. |
void |
put(long offset,
byte[] dst,
int off,
int len)
Bulk put method for multiple byte values. |
void |
put(long offset,
double[] dst,
int off,
int len)
Bulk put method for multiple double values. |
void |
put(long offset,
float[] dst,
int off,
int len)
Bulk put method for multiple float values. |
void |
put(long offset,
int[] dst,
int off,
int len)
Bulk put method for multiple int values. |
void |
put(long offset,
long[] dst,
int off,
int len)
Bulk put method for multiple long values. |
void |
put(long offset,
short[] dst,
int off,
int len)
Bulk put method for multiple short values. |
void |
putByte(long offset,
byte value)
Writes a byte (8 bit) value at the given offset. |
void |
putDouble(long offset,
double value)
Writes a double (64 bit, double precision) value at the given offset. |
void |
putFloat(long offset,
float value)
Writes a float (32 bit, single precision) value at the given offset. |
void |
putInt(long offset,
int value)
Writes an int (32 bit) value at the given offset. |
void |
putLong(long offset,
long value)
Writes a native long value at the given offset. |
void |
putLongLong(long offset,
long value)
Writes a long (64 bit) value at the given offset. |
void |
putPointer(long offset,
Pointer value)
Writes a Pointer value at the given offset. |
void |
putShort(long offset,
short value)
Writes a short (16 bit) value at the given offset. |
void |
putString(long offset,
java.lang.String string,
int maxLength,
java.nio.charset.Charset cs)
Writes a String value at the given offset, using a specific Charset |
void |
setMemory(long offset,
long size,
byte value)
Sets the value of each byte in the memory area represented by this Pointer. |
long |
size()
Gets the size of this memory object (optional operation). |
| Methods inherited from class jnr.ffi.provider.AbstractMemoryIO |
|---|
checkBounds, checkBounds, getAddress, getInt, getNativeLong, getRuntime, indexOf, putAddress, putAddress, putInt, putNativeLong, slice, slice, transferFrom, transferTo |
| Methods inherited from class jnr.ffi.Pointer |
|---|
newIntPointer, wrap, wrap, wrap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ShareMemoryIO(Pointer parent,
long offset)
| Method Detail |
|---|
public final boolean isDirect()
PointerMemory objects can be either direct (representing native memory), or non-direct (representing java heap memory).
Non-direct memory objects can still be passed to native functions as pointer (void *, char *, etc) parameters, but the java memory will first be copied to a temporary native memory area. The temporary memory area will then be used as the parameter value for the call. If needed, the java memory will be automatically reloaded from the temporary native memory after the native function returns.
Note: the transient nature of the temporary memory allocated for non-direct memory means native functions which store the address value passed to them will fail in unpredictable ways when using non-direct memory. You will need to explicitly allocate direct memory to use those types of functions.
isDirect in class Pointerpublic long address()
Pointer
address in class Pointerpublic long size()
Pointer
size in class PointerPointer points to. If
the size is unknown, Long.MAX_VALUE is returned}.public final boolean hasArray()
hasArray in class Pointerpublic final java.lang.Object array()
array in class Pointerpublic final int arrayOffset()
arrayOffset in class Pointerpublic final int arrayLength()
arrayLength in class Pointerpublic final Pointer getDelegatedMemoryIO()
getDelegatedMemoryIO in interface DelegatingMemoryIOpublic byte getByte(long offset)
Pointerbyte (8 bit) value at the given offset.
getByte in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be read.
byte value at the offset.public short getShort(long offset)
Pointershort (16 bit) value at the given offset.
getShort in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be read.
short value at the offset.public int getInt(long offset)
Pointerint (32 bit) value at the given offset.
getInt in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be read.
int value contained in the memory at the offset.public long getLong(long offset)
Pointerlong (64 bit) value at the given offset.
getLong in class AbstractMemoryIOoffset - The offset from the start of the memory this Pointer represents at which the value will be read.
long value at the offset.public long getLongLong(long offset)
Pointerlong (64 bit) value at the given offset.
getLongLong in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be read.
long value at the offset.public float getFloat(long offset)
Pointerfloat (32 bit) value at the given offset.
getFloat in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be read.
float value at the offset.public double getDouble(long offset)
Pointerdouble (64 bit) value at the given offset.
getDouble in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be read.
double value at the offset.public Pointer getPointer(long offset)
PointerPointer value at the given offset.
getPointer in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the value will be read.
Pointer value read from memory.
public Pointer getPointer(long offset,
long size)
PointerPointer value at the given offset.
getPointer in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the value will be read.size - the maximum size of the memory location the returned Pointer represents.
Pointer value read from memory.public java.lang.String getString(long offset)
PointerString value at the given offset.
getString in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the value will be read.
String value read from memory.
public java.lang.String getString(long offset,
int maxLength,
java.nio.charset.Charset cs)
PointerString value at the given offset, using a specific Charset
getString in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the value will be read.maxLength - the maximum size of memory to search for a NUL byte.cs - the Charset to use to decode the string.
String value read from memory.
public void putByte(long offset,
byte value)
Pointerbyte (8 bit) value at the given offset.
putByte in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the byte value to be written.
public void putShort(long offset,
short value)
Pointershort (16 bit) value at the given offset.
putShort in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the short value to be written.
public void putInt(long offset,
int value)
Pointerint (32 bit) value at the given offset.
putInt in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the int value to be written.
public void putLong(long offset,
long value)
Pointernative long value at the given offset.
putLong in class AbstractMemoryIOoffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the long value to be written.
public void putLongLong(long offset,
long value)
Pointerlong (64 bit) value at the given offset.
putLongLong in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the long value to be written.
public void putFloat(long offset,
float value)
Pointerfloat (32 bit, single precision) value at the given offset.
putFloat in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the float value to be written.
public void putDouble(long offset,
double value)
Pointerdouble (64 bit, double precision) value at the given offset.
putDouble in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the double value to be written.
public void putPointer(long offset,
Pointer value)
PointerPointer value at the given offset.
putPointer in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the value will be written.value - the Pointer value to be written to memory.
public void putString(long offset,
java.lang.String string,
int maxLength,
java.nio.charset.Charset cs)
PointerString value at the given offset, using a specific Charset
putString in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the value will be written.maxLength - the maximum size of memory to use to store the string.cs - the Charset to use to decode the string.
public void get(long offset,
byte[] dst,
int off,
int len)
Pointerbyte values.
This method reads multiple byte values from consecutive addresses,
beginning at the given offset, and stores them in an array.
get in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be read.dst - the array into which values are to be stored.off - the start index in the dst array to begin storing the values.len - the number of values to be read.
public void put(long offset,
byte[] dst,
int off,
int len)
Pointerbyte values.
This method writes multiple byte values to consecutive addresses,
beginning at the given offset, from an array.
put in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be written.dst - the array to get values from.off - the start index in the dst array to begin reading values.len - the number of values to be written.
public void get(long offset,
short[] dst,
int off,
int len)
Pointershort values.
This method reads multiple short values from consecutive addresses,
beginning at the given offset, and stores them in an array.
get in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the first value will be read.dst - The array into which values are to be stored.off - the start index in the dst array to begin storing the values.len - the number of values to be read.
public void put(long offset,
short[] dst,
int off,
int len)
Pointershort values.
This method writes multiple short values to consecutive addresses,
beginning at the given offset, from an array.
put in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be written.dst - the array to get values from.off - the start index in the dst array to begin reading values.len - the number of values to be written.
public void get(long offset,
int[] dst,
int off,
int len)
Pointerint values.
This method reads multiple int values from consecutive addresses,
beginning at the given offset, and stores them in an array.
get in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the first value will be read.dst - The array into which values are to be stored.off - the start index in the dst array to begin storing the values.len - the number of values to be read.
public void put(long offset,
int[] dst,
int off,
int len)
Pointerint values.
This method writes multiple int values to consecutive addresses,
beginning at the given offset, from an array.
put in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be written.dst - the array to get values from.off - the start index in the dst array to begin reading values.len - the number of values to be written.
public void get(long offset,
long[] dst,
int off,
int len)
Pointerlong values.
This method reads multiple long values from consecutive addresses,
beginning at the given offset, and stores them in an array.
get in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the first value will be read.dst - The array into which values are to be stored.off - the start index in the dst array to begin storing the values.len - the number of values to be read.
public void put(long offset,
long[] dst,
int off,
int len)
Pointerlong values.
This method writes multiple long values to consecutive addresses,
beginning at the given offset, from an array.
put in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be written.dst - the array to get values from.off - the start index in the dst array to begin reading values.len - the number of values to be written.
public void get(long offset,
float[] dst,
int off,
int len)
Pointerfloat values.
This method reads multiple float values from consecutive addresses,
beginning at the given offset, and stores them in an array.
get in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the first value will be read.dst - The array into which values are to be stored.off - the start index in the dst array to begin storing the values.len - the number of values to be read.
public void put(long offset,
float[] dst,
int off,
int len)
Pointerfloat values.
This method writes multiple float values to consecutive addresses,
beginning at the given offset, from an array.
put in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be written.dst - the array to get values from.off - the start index in the dst array to begin reading values.len - the number of values to be written.
public void get(long offset,
double[] dst,
int off,
int len)
Pointerdouble values.
This method reads multiple double values from consecutive addresses,
beginning at the given offset, and stores them in an array.
get in class Pointeroffset - The offset from the start of the memory this Pointer represents at which the first value will be read.dst - The array into which values are to be stored.off - the start index in the dst array to begin storing the values.len - the number of values to be read.
public void put(long offset,
double[] dst,
int off,
int len)
Pointerdouble values.
This method writes multiple double values to consecutive addresses,
beginning at the given offset, from an array.
put in class Pointeroffset - the offset from the start of the memory this Pointer represents at which the first value will be written.dst - the array to get values from.off - the start index in the dst array to begin reading values.len - the number of values to be written.
public int indexOf(long offset,
byte value,
int maxlen)
PointerPointer.
indexOf in class Pointeroffset - the offset from the start of the memory location this Pointer represents to begin searching.value - the byte value to locate.maxlen - the maximum number of bytes to search for the desired value.
public void setMemory(long offset,
long size,
byte value)
PointerPointer.
to a specified value.
setMemory in class Pointeroffset - the offset from the start of the memory location this Pointer represents to begin writing to.size - the number of bytes to set to the value.value - the value to set each byte to.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||