Package one.microstream.memory
Interface MemoryAccessor
- All Known Implementing Classes:
JdkMemoryAccessor
,MemoryAccessorGeneric
,MemoryAccessorReversing
public interface MemoryAccessor
-
Method Summary
Modifier and Type Method Description long
allocateMemory(long bytes)
default byte[]
asByteArray(long value)
default byte[]
asByteArray(long[] values)
void
copyArrayToAddress(boolean[] array, long targetAddress)
void
copyArrayToAddress(byte[] array, long targetAddress)
void
copyArrayToAddress(char[] array, long targetAddress)
void
copyArrayToAddress(double[] array, long targetAddress)
void
copyArrayToAddress(float[] array, long targetAddress)
void
copyArrayToAddress(int[] array, long targetAddress)
void
copyArrayToAddress(long[] array, long targetAddress)
void
copyArrayToAddress(short[] array, long targetAddress)
void
copyRange(long sourceAddress, long targetAddress, long length)
void
copyRangeToArray(long sourceAddress, boolean[] target)
void
copyRangeToArray(long sourceAddress, byte[] target)
void
copyRangeToArray(long sourceAddress, char[] target)
void
copyRangeToArray(long sourceAddress, double[] target)
void
copyRangeToArray(long sourceAddress, float[] target)
void
copyRangeToArray(long sourceAddress, int[] target)
void
copyRangeToArray(long sourceAddress, long[] target)
void
copyRangeToArray(long sourceAddress, short[] target)
MemoryStatistics
createHeapMemoryStatistics()
MemoryStatistics
createNonHeapMemoryStatistics()
boolean
deallocateDirectByteBuffer(ByteBuffer directBuffer)
void
ensureClassInitialized(Class<?> c)
default void
ensureClassInitialized(Class<?> c, Iterable<Field> usedFields)
Uses the passed fields if required by the implementation.void
fillMemory(long targetAddress, long length, byte value)
void
freeMemory(long address)
boolean
get_boolean(long address)
boolean
get_boolean(Object instance, long offset)
byte
get_byte(long address)
byte
get_byte(Object instance, long offset)
char
get_char(long address)
char
get_char(Object instance, long offset)
double
get_double(long address)
double
get_double(Object instance, long offset)
float
get_float(long address)
float
get_float(Object instance, long offset)
int
get_int(long address)
int
get_int(Object instance, long offset)
long
get_long(long address)
long
get_long(Object instance, long offset)
short
get_short(long address)
short
get_short(Object instance, long offset)
long
getDirectByteBufferAddress(ByteBuffer directBuffer)
Object
getObject(Object instance, long offset)
ByteBuffer
guaranteeDirectByteBuffer(ByteBuffer directBuffer)
void
guaranteeUsability()
Guarantees the full usability of this class by validating if all functionality is usable.<T> T
instantiateBlank(Class<T> c)
boolean
isDirectByteBuffer(ByteBuffer byteBuffer)
default boolean
isReversing()
long
objectFieldOffset(Class<?> objectClass, Field field)
Similar toobjectFieldOffset(Field)
, but with the specific object class.
The difference is that the actual object's class is not the declaring class of its fields if it only extends another class but does not declare an object field itself.long
objectFieldOffset(Field field)
Returns an unspecified, abstract "offset" of the passedField
to specify a generic access of the field's value for an instance of its declaring class that can be used with object-based methods likeset_int(Object,long,int)
.default long[]
objectFieldOffsets(Class<?> objectClass)
long[]
objectFieldOffsets(Class<?> objectClass, Field... fields)
Array alias vor #objectFieldOffset(Class, Field).default long[]
objectFieldOffsets(Class<?> objectClass, Predicate<? super Field> selector)
long[]
objectFieldOffsets(Field... fields)
Array alias vor #objectFieldOffset(Field).long
reallocateMemory(long address, long bytes)
void
set_boolean(long address, boolean value)
void
set_boolean(Object instance, long offset, boolean value)
void
set_booleanInBytes(byte[] bytes, int index, boolean value)
void
set_byte(long address, byte value)
void
set_byte(Object instance, long offset, byte value)
void
set_byteInBytes(byte[] bytes, int index, byte value)
void
set_char(long address, char value)
void
set_char(Object instance, long offset, char value)
void
set_charInBytes(byte[] bytes, int index, char value)
void
set_double(long address, double value)
void
set_double(Object instance, long offset, double value)
void
set_doubleInBytes(byte[] bytes, int index, double value)
void
set_float(long address, float value)
void
set_float(Object instance, long offset, float value)
void
set_floatInBytes(byte[] bytes, int index, float value)
void
set_int(long address, int value)
void
set_int(Object instance, long offset, int value)
void
set_intInBytes(byte[] bytes, int index, int value)
void
set_long(long address, long value)
void
set_long(Object instance, long offset, long value)
void
set_longInBytes(byte[] bytes, int index, long value)
void
set_short(long address, short value)
void
set_short(Object instance, long offset, short value)
void
set_shortInBytes(byte[] bytes, int index, short value)
void
setObject(Object instance, long offset, Object value)
default MemoryAccessor
toReversing()
-
Method Details
-
guaranteeUsability
void guaranteeUsability()Guarantees the full usability of this class by validating if all functionality is usable.- Throws:
Error
-
getDirectByteBufferAddress
-
deallocateDirectByteBuffer
-
isDirectByteBuffer
-
guaranteeDirectByteBuffer
-
allocateMemory
long allocateMemory(long bytes) -
reallocateMemory
long reallocateMemory(long address, long bytes) -
freeMemory
void freeMemory(long address) -
fillMemory
void fillMemory(long targetAddress, long length, byte value) -
get_byte
byte get_byte(long address) -
get_boolean
boolean get_boolean(long address) -
get_short
short get_short(long address) -
get_char
char get_char(long address) -
get_int
int get_int(long address) -
get_float
float get_float(long address) -
get_long
long get_long(long address) -
get_double
double get_double(long address) -
get_byte
-
get_boolean
-
get_short
-
get_char
-
get_int
-
get_float
-
get_long
-
get_double
-
getObject
-
set_byte
void set_byte(long address, byte value) -
set_boolean
void set_boolean(long address, boolean value) -
set_short
void set_short(long address, short value) -
set_char
void set_char(long address, char value) -
set_int
void set_int(long address, int value) -
set_float
void set_float(long address, float value) -
set_long
void set_long(long address, long value) -
set_double
void set_double(long address, double value) -
set_byte
-
set_boolean
-
set_short
-
set_char
-
set_int
-
set_float
-
set_long
-
set_double
-
setObject
-
set_byteInBytes
void set_byteInBytes(byte[] bytes, int index, byte value) -
set_booleanInBytes
void set_booleanInBytes(byte[] bytes, int index, boolean value) -
set_shortInBytes
void set_shortInBytes(byte[] bytes, int index, short value) -
set_charInBytes
void set_charInBytes(byte[] bytes, int index, char value) -
set_intInBytes
void set_intInBytes(byte[] bytes, int index, int value) -
set_floatInBytes
void set_floatInBytes(byte[] bytes, int index, float value) -
set_longInBytes
void set_longInBytes(byte[] bytes, int index, long value) -
set_doubleInBytes
void set_doubleInBytes(byte[] bytes, int index, double value) -
copyRange
void copyRange(long sourceAddress, long targetAddress, long length) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, byte[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, boolean[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, short[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, char[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, int[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, float[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, long[] target) -
copyRangeToArray
void copyRangeToArray(long sourceAddress, double[] target) -
copyArrayToAddress
void copyArrayToAddress(byte[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(boolean[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(short[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(char[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(int[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(float[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(long[] array, long targetAddress) -
copyArrayToAddress
void copyArrayToAddress(double[] array, long targetAddress) -
asByteArray
default byte[] asByteArray(long[] values) -
asByteArray
default byte[] asByteArray(long value) -
objectFieldOffset
Returns an unspecified, abstract "offset" of the passedField
to specify a generic access of the field's value for an instance of its declaring class that can be used with object-based methods likeset_int(Object,long,int)
. Whether that offset is an actual low-level memory offset relative to an instance' field offset base or simply an index of the passed field in its declaring class' list of fields, is implementation-specific. -
objectFieldOffsets
Array alias vor #objectFieldOffset(Field). -
objectFieldOffset
Similar toobjectFieldOffset(Field)
, but with the specific object class.
The difference is that the actual object's class is not the declaring class of its fields if it only extends another class but does not declare an object field itself.- Parameters:
objectClass
-field
-- Returns:
-
objectFieldOffsets
Array alias vor #objectFieldOffset(Class, Field). -
objectFieldOffsets
-
objectFieldOffsets
-
ensureClassInitialized
-
ensureClassInitialized
Uses the passed fields if required by the implementation. If not, this method behaves exactely likeensureClassInitialized(Class)
.- Parameters:
c
-usedFields
-
-
instantiateBlank
- Throws:
InstantiationRuntimeException
-
createHeapMemoryStatistics
MemoryStatistics createHeapMemoryStatistics() -
createNonHeapMemoryStatistics
MemoryStatistics createNonHeapMemoryStatistics() -
isReversing
default boolean isReversing() -
toReversing
-