public final class BoundedMemoryIO extends AbstractMemoryIO implements DelegatingMemoryIO
Constructor and Description |
---|
BoundedMemoryIO(Pointer parent,
long offset,
long size) |
Modifier and Type | Method and Description |
---|---|
Object |
array()
Returns the array that backs this pointer.
|
int |
arrayLength()
Returns the length of this pointer's backing array that is used by this pointer.
|
int |
arrayOffset()
Returns the offset within this pointer's backing array of the first element.
|
void |
checkBounds(long offset,
long length)
Checks that the memory region is within the bounds of this memory object
|
boolean |
equals(Object obj) |
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. |
long |
getAddress(long offset)
Reads a native memory address value at the given offset.
|
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 |
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. |
String |
getString(long offset)
Reads an
String value at the given offset. |
String |
getString(long offset,
int maxLength,
Charset cs)
Reads a
String value at the given offset, using a specific Charset |
boolean |
hasArray()
Indicates whether this Pointer instance is backed by an array.
|
int |
hashCode() |
int |
indexOf(long offset,
byte value)
Returns the location of a byte value within the memory area represented by this
Pointer . |
int |
indexOf(long offset,
byte value,
int maxlen)
Returns the location of a byte value within the memory area represented by this
Pointer . |
void |
put(long offset,
byte[] dst,
int off,
int len)
Bulk put method for multiple
byte values. |
void |
put(long offset,
double[] src,
int off,
int len)
Bulk put method for multiple
double values. |
void |
put(long offset,
float[] src,
int off,
int len)
Bulk put method for multiple
float values. |
void |
put(long offset,
int[] src,
int off,
int len)
Bulk put method for multiple
int values. |
void |
put(long offset,
long[] src,
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 |
putAddress(long offset,
Address value)
Writes a native memory address value at the given offset.
|
void |
putAddress(long offset,
long value)
Writes a native memory address value at the given offset.
|
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 |
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,
String string,
int maxLength,
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 in bytes (optional operation).
|
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.
|
checkBounds, getInt, getLong, getNativeLong, putInt, putLong, putNativeLong, slice, slice
address, get, getNullTerminatedPointerArray, getNullTerminatedStringArray, getRuntime, isDirect, newIntPointer, put, toString, wrap, wrap, wrap
public BoundedMemoryIO(Pointer parent, long offset, long size)
public long size()
Pointer
size
in class Pointer
Pointer
points to. If
the size is unknown, Long.MAX_VALUE
is returned}.public final boolean hasArray()
Pointer
public final Object array()
Pointer
public final int arrayOffset()
Pointer
arrayOffset
in class Pointer
public final int arrayLength()
Pointer
arrayLength
in class Pointer
public void checkBounds(long offset, long length)
Pointer
checkBounds
in class AbstractMemoryIO
offset
- the starting point within this memory region.length
- the length of the memory region in bytespublic Pointer getDelegatedMemoryIO()
getDelegatedMemoryIO
in interface DelegatingMemoryIO
public byte getByte(long offset)
Pointer
byte
(8 bit) value at the given offset.public short getShort(long offset)
Pointer
short
(16 bit) value at the given offset.public int getInt(long offset)
Pointer
int
(32 bit) value at the given offset.public long getLongLong(long offset)
Pointer
long
(64 bit) value at the given offset.getLongLong
in class Pointer
offset
- 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)
Pointer
float
(32 bit) value at the given offset.public double getDouble(long offset)
Pointer
double
(64 bit) value at the given offset.public Pointer getPointer(long offset)
Pointer
Pointer
value at the given offset.getPointer
in class Pointer
offset
- 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)
Pointer
Pointer
value at the given offset.getPointer
in class Pointer
offset
- 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 void putByte(long offset, byte value)
Pointer
byte
(8 bit) value at the given offset.public void putShort(long offset, short value)
Pointer
short
(16 bit) value at the given offset.public void putInt(long offset, int value)
Pointer
int
(32 bit) value at the given offset.public void putLongLong(long offset, long value)
Pointer
long
(64 bit) value at the given offset.putLongLong
in class Pointer
offset
- 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)
Pointer
float
(32 bit, single precision) value at the given offset.public void putDouble(long offset, double value)
Pointer
double
(64 bit, double precision) value at the given offset.public void putPointer(long offset, Pointer value)
Pointer
Pointer
value at the given offset.putPointer
in class Pointer
offset
- 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 get(long offset, byte[] dst, int off, int len)
Pointer
byte
values.
This method reads multiple byte
values from consecutive addresses,
beginning at the given offset, and stores them in an array.get
in class Pointer
offset
- 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)
Pointer
byte
values.
This method writes multiple byte
values to consecutive addresses,
beginning at the given offset, from an array.put
in class Pointer
offset
- 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)
Pointer
short
values.
This method reads multiple short
values from consecutive addresses,
beginning at the given offset, and stores them in an array.get
in class Pointer
offset
- 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)
Pointer
short
values.
This method writes multiple short
values to consecutive addresses,
beginning at the given offset, from an array.put
in class Pointer
offset
- 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)
Pointer
int
values.
This method reads multiple int
values from consecutive addresses,
beginning at the given offset, and stores them in an array.get
in class Pointer
offset
- 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[] src, int off, int len)
Pointer
int
values.
This method writes multiple int
values to consecutive addresses,
beginning at the given offset, from an array.put
in class Pointer
offset
- the offset from the start of the memory this Pointer
represents at which the first value will be written.src
- 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)
Pointer
long
values.
This method reads multiple long
values from consecutive addresses,
beginning at the given offset, and stores them in an array.get
in class Pointer
offset
- 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[] src, int off, int len)
Pointer
long
values.
This method writes multiple long
values to consecutive addresses,
beginning at the given offset, from an array.put
in class Pointer
offset
- the offset from the start of the memory this Pointer
represents at which the first value will be written.src
- 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)
Pointer
float
values.
This method reads multiple float
values from consecutive addresses,
beginning at the given offset, and stores them in an array.get
in class Pointer
offset
- 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[] src, int off, int len)
Pointer
float
values.
This method writes multiple float
values to consecutive addresses,
beginning at the given offset, from an array.put
in class Pointer
offset
- the offset from the start of the memory this Pointer
represents at which the first value will be written.src
- 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)
Pointer
double
values.
This method reads multiple double
values from consecutive addresses,
beginning at the given offset, and stores them in an array.get
in class Pointer
offset
- 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[] src, int off, int len)
Pointer
double
values.
This method writes multiple double
values to consecutive addresses,
beginning at the given offset, from an array.put
in class Pointer
offset
- the offset from the start of the memory this Pointer
represents at which the first value will be written.src
- 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 long getAddress(long offset)
Pointer
A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
getAddress
in class AbstractMemoryIO
offset
- The offset from the start of the memory this Pointer
represents at which the value will be read.Address
public String getString(long offset, int maxLength, Charset cs)
Pointer
String
value at the given offset, using a specific Charset
getString
in class Pointer
offset
- 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 String getString(long offset)
Pointer
String
value at the given offset.public void putAddress(long offset, long value)
Pointer
A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
putAddress
in class AbstractMemoryIO
offset
- The offset from the start of the memory this Pointer
represents at which the value will be written.value
- The native address value to be written.Address
public void putAddress(long offset, Address value)
Pointer
A native address can be either 32 or 64 bits in size, depending on the cpu architecture.
putAddress
in class AbstractMemoryIO
offset
- The offset from the start of the memory this Pointer
represents at which the value will be written.value
- The native address value to be written.Address
public void putString(long offset, String string, int maxLength, Charset cs)
Pointer
String
value at the given offset, using a specific Charset
putString
in class Pointer
offset
- the offset from the start of the memory this Pointer
represents at which the value will be written.string
- the string to be written.maxLength
- the maximum size of memory to use to store the string.cs
- the Charset
to use to decode the string.public int indexOf(long offset, byte value)
Pointer
Pointer
.indexOf
in class AbstractMemoryIO
offset
- the offset from the start of the memory location this Pointer
represents to begin searching.value
- the byte
value to locate.public int indexOf(long offset, byte value, int maxlen)
Pointer
Pointer
.indexOf
in class Pointer
offset
- 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)
Pointer
Pointer
.
to a specified value.public void transferFrom(long offset, Pointer other, long otherOffset, long count)
Pointer
transferFrom
in class AbstractMemoryIO
offset
- the offset from the start of the memory location this Pointer
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 destination Pointer
represents to begin copying from.count
- the number of bytes to transfer.public void transferTo(long offset, Pointer other, long otherOffset, long count)
Pointer
transferTo
in class AbstractMemoryIO
offset
- the offset from the start of the memory location this Pointer
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 destination Pointer
represents to begin copying to.count
- the number of bytes to transfer.Copyright © 2017. All rights reserved.