Package one.microstream.memory
Class MemoryAccessorGeneric
java.lang.Object
one.microstream.memory.MemoryAccessorGeneric
- All Implemented Interfaces:
MemoryAccessor
public final class MemoryAccessorGeneric extends Object implements MemoryAccessor
-
Method Summary
Modifier and Type Method Description long
allocateMemory(long bytes)
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)
static Class<?>
determineMostSpecificDeclaringClass(Field[] fields)
void
ensureClassInitialized(Class<?> c)
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)
ByteBuffer[]
lookupChain(int chunkSizeIndex)
ByteBuffer[]
lookupChainNonNull(int chunkSizeIndex, int chainIndex)
static MemoryAccessorGeneric
New()
static MemoryAccessorGeneric
New(DefaultInstantiator defaultInstantiator)
static MemoryAccessorGeneric
New(DefaultInstantiator defaultInstantiator, DirectBufferDeallocator directBufferDeallocator)
static MemoryAccessorGeneric
New(DirectBufferDeallocator directBufferDeallocator)
long
objectFieldOffset(Class<?> objectClass, Field field)
Similar toMemoryAccessor.objectFieldOffset(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)
.long[]
objectFieldOffsets(Class<?> objectClass, Field... fields)
Array alias vor #objectFieldOffset(Class, Field).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)
boolean
systemDeallocateDirectByteBuffer(ByteBuffer directByteBuffer)
MemoryAccessor
toReversing()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface one.microstream.memory.MemoryAccessor
asByteArray, asByteArray, isReversing, objectFieldOffsets, objectFieldOffsets
-
Method Details
-
New
-
New
-
New
-
New
public static MemoryAccessorGeneric New(DefaultInstantiator defaultInstantiator, DirectBufferDeallocator directBufferDeallocator) -
systemDeallocateDirectByteBuffer
-
guaranteeUsability
public final void guaranteeUsability()Description copied from interface:MemoryAccessor
Guarantees the full usability of this class by validating if all functionality is usable.- Specified by:
guaranteeUsability
in interfaceMemoryAccessor
-
getDirectByteBufferAddress
- Specified by:
getDirectByteBufferAddress
in interfaceMemoryAccessor
-
deallocateDirectByteBuffer
- Specified by:
deallocateDirectByteBuffer
in interfaceMemoryAccessor
-
isDirectByteBuffer
- Specified by:
isDirectByteBuffer
in interfaceMemoryAccessor
-
guaranteeDirectByteBuffer
- Specified by:
guaranteeDirectByteBuffer
in interfaceMemoryAccessor
-
allocateMemory
public final long allocateMemory(long bytes)- Specified by:
allocateMemory
in interfaceMemoryAccessor
-
reallocateMemory
public final long reallocateMemory(long address, long bytes)- Specified by:
reallocateMemory
in interfaceMemoryAccessor
-
freeMemory
public final void freeMemory(long address)- Specified by:
freeMemory
in interfaceMemoryAccessor
-
lookupChainNonNull
-
lookupChain
-
fillMemory
public final void fillMemory(long targetAddress, long length, byte value)- Specified by:
fillMemory
in interfaceMemoryAccessor
-
get_byte
public final byte get_byte(long address)- Specified by:
get_byte
in interfaceMemoryAccessor
-
get_boolean
public final boolean get_boolean(long address)- Specified by:
get_boolean
in interfaceMemoryAccessor
-
get_short
public final short get_short(long address)- Specified by:
get_short
in interfaceMemoryAccessor
-
get_char
public final char get_char(long address)- Specified by:
get_char
in interfaceMemoryAccessor
-
get_int
public final int get_int(long address)- Specified by:
get_int
in interfaceMemoryAccessor
-
get_float
public final float get_float(long address)- Specified by:
get_float
in interfaceMemoryAccessor
-
get_long
public final long get_long(long address)- Specified by:
get_long
in interfaceMemoryAccessor
-
get_double
public final double get_double(long address)- Specified by:
get_double
in interfaceMemoryAccessor
-
get_byte
- Specified by:
get_byte
in interfaceMemoryAccessor
-
get_boolean
- Specified by:
get_boolean
in interfaceMemoryAccessor
-
get_short
- Specified by:
get_short
in interfaceMemoryAccessor
-
get_char
- Specified by:
get_char
in interfaceMemoryAccessor
-
get_int
- Specified by:
get_int
in interfaceMemoryAccessor
-
get_float
- Specified by:
get_float
in interfaceMemoryAccessor
-
get_long
- Specified by:
get_long
in interfaceMemoryAccessor
-
get_double
- Specified by:
get_double
in interfaceMemoryAccessor
-
getObject
- Specified by:
getObject
in interfaceMemoryAccessor
-
set_byte
public final void set_byte(long address, byte value)- Specified by:
set_byte
in interfaceMemoryAccessor
-
set_boolean
public final void set_boolean(long address, boolean value)- Specified by:
set_boolean
in interfaceMemoryAccessor
-
set_short
public final void set_short(long address, short value)- Specified by:
set_short
in interfaceMemoryAccessor
-
set_char
public final void set_char(long address, char value)- Specified by:
set_char
in interfaceMemoryAccessor
-
set_int
public final void set_int(long address, int value)- Specified by:
set_int
in interfaceMemoryAccessor
-
set_float
public final void set_float(long address, float value)- Specified by:
set_float
in interfaceMemoryAccessor
-
set_long
public final void set_long(long address, long value)- Specified by:
set_long
in interfaceMemoryAccessor
-
set_double
public final void set_double(long address, double value)- Specified by:
set_double
in interfaceMemoryAccessor
-
set_byte
- Specified by:
set_byte
in interfaceMemoryAccessor
-
set_boolean
- Specified by:
set_boolean
in interfaceMemoryAccessor
-
set_short
- Specified by:
set_short
in interfaceMemoryAccessor
-
set_char
- Specified by:
set_char
in interfaceMemoryAccessor
-
set_int
- Specified by:
set_int
in interfaceMemoryAccessor
-
set_float
- Specified by:
set_float
in interfaceMemoryAccessor
-
set_long
- Specified by:
set_long
in interfaceMemoryAccessor
-
set_double
- Specified by:
set_double
in interfaceMemoryAccessor
-
setObject
- Specified by:
setObject
in interfaceMemoryAccessor
-
set_byteInBytes
public final void set_byteInBytes(byte[] bytes, int index, byte value)- Specified by:
set_byteInBytes
in interfaceMemoryAccessor
-
set_booleanInBytes
public final void set_booleanInBytes(byte[] bytes, int index, boolean value)- Specified by:
set_booleanInBytes
in interfaceMemoryAccessor
-
set_shortInBytes
public final void set_shortInBytes(byte[] bytes, int index, short value)- Specified by:
set_shortInBytes
in interfaceMemoryAccessor
-
set_charInBytes
public final void set_charInBytes(byte[] bytes, int index, char value)- Specified by:
set_charInBytes
in interfaceMemoryAccessor
-
set_intInBytes
public final void set_intInBytes(byte[] bytes, int index, int value)- Specified by:
set_intInBytes
in interfaceMemoryAccessor
-
set_floatInBytes
public final void set_floatInBytes(byte[] bytes, int index, float value)- Specified by:
set_floatInBytes
in interfaceMemoryAccessor
-
set_longInBytes
public final void set_longInBytes(byte[] bytes, int index, long value)- Specified by:
set_longInBytes
in interfaceMemoryAccessor
-
set_doubleInBytes
public final void set_doubleInBytes(byte[] bytes, int index, double value)- Specified by:
set_doubleInBytes
in interfaceMemoryAccessor
-
copyRange
public final void copyRange(long sourceAddress, long targetAddress, long length)- Specified by:
copyRange
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, byte[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, boolean[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, short[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, char[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, int[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, float[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, long[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, double[] target)- Specified by:
copyRangeToArray
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(byte[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(boolean[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(short[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(char[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(int[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(float[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(long[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(double[] array, long targetAddress)- Specified by:
copyArrayToAddress
in interfaceMemoryAccessor
-
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.- Specified by:
objectFieldOffset
in interfaceMemoryAccessor
- Parameters:
field
- theField
whose abstract offset shall be determined.- Returns:
- the passed
Field
's abstract offset.
-
determineMostSpecificDeclaringClass
-
objectFieldOffsets
Array alias vor #objectFieldOffset(Field).- Specified by:
objectFieldOffsets
in interfaceMemoryAccessor
- Parameters:
fields
- the fields to retrieve the offsets for- Returns:
- the fields' offsets
-
objectFieldOffset
Description copied from interface:MemoryAccessor
Similar toMemoryAccessor.objectFieldOffset(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.- Specified by:
objectFieldOffset
in interfaceMemoryAccessor
- Parameters:
objectClass
- specific object classfield
- the field to retrieve the offset for- Returns:
- the field's offset
-
objectFieldOffsets
Description copied from interface:MemoryAccessor
Array alias vor #objectFieldOffset(Class, Field).- Specified by:
objectFieldOffsets
in interfaceMemoryAccessor
- Parameters:
objectClass
- specific object classfields
- the fields to retrieve the offsets for- Returns:
- the fields' offsets
-
ensureClassInitialized
- Specified by:
ensureClassInitialized
in interfaceMemoryAccessor
-
ensureClassInitialized
Description copied from interface:MemoryAccessor
Uses the passed fields if required by the implementation. If not, this method behaves exactely likeMemoryAccessor.ensureClassInitialized(Class)
.- Specified by:
ensureClassInitialized
in interfaceMemoryAccessor
- Parameters:
c
- the class to ensure the initialization forusedFields
- the used fields
-
instantiateBlank
- Specified by:
instantiateBlank
in interfaceMemoryAccessor
- Throws:
InstantiationRuntimeException
-
createHeapMemoryStatistics
- Specified by:
createHeapMemoryStatistics
in interfaceMemoryAccessor
-
createNonHeapMemoryStatistics
- Specified by:
createNonHeapMemoryStatistics
in interfaceMemoryAccessor
-
toReversing
- Specified by:
toReversing
in interfaceMemoryAccessor
-