private abstract static class MemoryIO.UnsafeImpl extends MemoryIO
Modifier and Type | Field and Description |
---|---|
protected static sun.misc.Unsafe |
unsafe |
Modifier | Constructor and Description |
---|---|
private |
UnsafeImpl() |
Modifier and Type | Method and Description |
---|---|
void |
_copyMemory(long src,
long dst,
long size)
Copies contents of a native memory location to another native memory location.
|
byte |
getByte(long address)
Reads an 8 bit integer from a native memory location.
|
void |
getByteArray(long address,
byte[] data,
int offset,
int length)
Reads a java byte array from native memory.
|
void |
getCharArray(long address,
char[] data,
int offset,
int length)
Reads a java char array from native memory.
|
double |
getDouble(long address)
Reads a 64 bit floating point value from a native memory location.
|
void |
getDoubleArray(long address,
double[] data,
int offset,
int length)
Reads a java double array from native memory.
|
float |
getFloat(long address)
Reads a 32 bit floating point value from a native memory location.
|
void |
getFloatArray(long address,
float[] data,
int offset,
int length)
Reads a java float array from native memory.
|
int |
getInt(long address)
Reads a 32 bit integer from a native memory location.
|
void |
getIntArray(long address,
int[] data,
int offset,
int length)
Reads a java int array from native memory.
|
long |
getLong(long address)
Reads a 64 bit integer from a native memory location.
|
void |
getLongArray(long address,
long[] data,
int offset,
int length)
Reads a java long array from native memory.
|
short |
getShort(long address)
Reads a 16 bit integer from a native memory location.
|
void |
getShortArray(long address,
short[] data,
int offset,
int length)
Reads a java short array from native memory.
|
long |
getStringLength(long address)
Gets the length of a native ascii or utf-8 string.
|
private static java.lang.Object |
getUnsafe() |
byte[] |
getZeroTerminatedByteArray(long address)
Reads a byte array from native memory, stopping when a zero byte is found.
|
byte[] |
getZeroTerminatedByteArray(long address,
int maxlen)
Reads a byte array from native memory, stopping when a zero byte is found,
or the maximum length is reached.
|
long |
memchr(long address,
int value,
long size)
Gets the address of a byte value in a native memory region.
|
void |
memcpy(long dst,
long src,
long size)
Copies bytes from one memory location to another.
|
void |
memmove(long dst,
long src,
long size)
Copies potentially overlapping memory areas.
|
void |
putByte(long address,
byte value)
Writes an 8 bit integer value to a native memory location.
|
void |
putByteArray(long address,
byte[] data,
int offset,
int length)
Writes a java byte array to native memory.
|
void |
putCharArray(long address,
char[] data,
int offset,
int length)
Writes a java char array to native memory.
|
void |
putDouble(long address,
double value)
Writes a 64 bit floating point value to a native memory location.
|
void |
putDoubleArray(long address,
double[] data,
int offset,
int length)
Writes a java double array to native memory.
|
void |
putFloat(long address,
float value)
Writes a 32 bit floating point value to a native memory location.
|
void |
putFloatArray(long address,
float[] data,
int offset,
int length)
Writes a java double array to native memory.
|
void |
putInt(long address,
int value)
Writes a 32 bit integer value to a native memory location.
|
void |
putIntArray(long address,
int[] data,
int offset,
int length)
Writes a java int array to native memory.
|
void |
putLong(long address,
long value)
Writes a 64 bit integer value to a native memory location.
|
void |
putLongArray(long address,
long[] data,
int offset,
int length)
Writes a java long array to native memory.
|
void |
putShort(long address,
short value)
Writes a 16 bit integer value to a native memory location.
|
void |
putShortArray(long address,
short[] data,
int offset,
int length)
Writes a java short array to native memory.
|
void |
putZeroTerminatedByteArray(long address,
byte[] data,
int offset,
int length)
Copies a java byte array to native memory and appends a NUL terminating byte.
|
void |
setMemory(long src,
long size,
byte value)
Sets a region of native memory to a specific byte value.
|
allocateMemory, copyMemory, freeMemory, getAddress, getCheckedInstance, getDirectBufferAddress, getInstance, getZeroTerminatedByteArray, indexOf, indexOf, isUnsafeAvailable, memset, newDirectByteBuffer, putAddress
private static java.lang.Object getUnsafe()
public final byte getByte(long address)
MemoryIO
public final short getShort(long address)
MemoryIO
public final int getInt(long address)
MemoryIO
public final long getLong(long address)
MemoryIO
public final float getFloat(long address)
MemoryIO
public final double getDouble(long address)
MemoryIO
public final void putByte(long address, byte value)
MemoryIO
public final void putShort(long address, short value)
MemoryIO
public final void putInt(long address, int value)
MemoryIO
public final void putLong(long address, long value)
MemoryIO
public final void putFloat(long address, float value)
MemoryIO
public final void putDouble(long address, double value)
MemoryIO
public final void _copyMemory(long src, long dst, long size)
MemoryIO
_copyMemory
in class MemoryIO
src
- The source memory address.dst
- The destination memory address.size
- The number of bytes to copy.public final void setMemory(long src, long size, byte value)
MemoryIO
public final void memcpy(long dst, long src, long size)
MemoryIO
public final void memmove(long dst, long src, long size)
MemoryIO
public final long memchr(long address, int value, long size)
MemoryIO
public final void putByteArray(long address, byte[] data, int offset, int length)
MemoryIO
putByteArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getByteArray(long address, byte[] data, int offset, int length)
MemoryIO
getByteArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final void putCharArray(long address, char[] data, int offset, int length)
MemoryIO
putCharArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getCharArray(long address, char[] data, int offset, int length)
MemoryIO
getCharArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final void putShortArray(long address, short[] data, int offset, int length)
MemoryIO
putShortArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getShortArray(long address, short[] data, int offset, int length)
MemoryIO
getShortArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final void putIntArray(long address, int[] data, int offset, int length)
MemoryIO
putIntArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getIntArray(long address, int[] data, int offset, int length)
MemoryIO
getIntArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final void putLongArray(long address, long[] data, int offset, int length)
MemoryIO
putLongArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getLongArray(long address, long[] data, int offset, int length)
MemoryIO
getLongArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final void putFloatArray(long address, float[] data, int offset, int length)
MemoryIO
putFloatArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getFloatArray(long address, float[] data, int offset, int length)
MemoryIO
getFloatArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final void putDoubleArray(long address, double[] data, int offset, int length)
MemoryIO
putDoubleArray
in class MemoryIO
address
- The native memory address to copy the array to.data
- The java array to copy.offset
- The offset within the array to start copying from.length
- The number of array elements to copy.public final void getDoubleArray(long address, double[] data, int offset, int length)
MemoryIO
getDoubleArray
in class MemoryIO
address
- The native memory address to copy the array from.data
- The java array to copy.offset
- The offset within the array to start copying to.length
- The number of array elements to copy.public final long getStringLength(long address)
MemoryIO
getStringLength
in class MemoryIO
address
- The native address of the string.public final byte[] getZeroTerminatedByteArray(long address)
MemoryIO
getZeroTerminatedByteArray
in class MemoryIO
address
- The address to read the data from.public final byte[] getZeroTerminatedByteArray(long address, int maxlen)
MemoryIO
getZeroTerminatedByteArray
in class MemoryIO
address
- The address to read the data from.maxlen
- The limit of the memory area to scan for a zero byte.public final void putZeroTerminatedByteArray(long address, byte[] data, int offset, int length)
MemoryIO
putZeroTerminatedByteArray
in class MemoryIO
address
- The address to copy to.data
- The byte array to copy to native memoryoffset
- The offset within the byte array to begin copying fromlength
- The number of bytes to copy to native memory