public class NativeMemory extends Object implements Memory
UnsafeMemory.Util| Modifier and Type | Method and Description |
|---|---|
long |
address()
Returns the memory address.
|
long |
address(int offset)
Returns the memory address for the given offset.
|
static NativeMemory |
allocate(int size)
Allocates native memory via
DirectMemoryAllocator. |
MemoryAllocator<NativeMemory> |
allocator()
Returns the memory allocator that allocated this memory.
|
void |
clear()
Clears the memory.
|
NativeMemory |
copy()
Copies the memory to a distinct memory address.
|
void |
free()
Frees the memory.
|
byte |
getByte(int offset)
Fetches a byte from the given memory offset.
|
char |
getChar(int offset)
Fetches a character from the given memory offset.
|
double |
getDouble(int offset)
Fetches a double from the given memory offset.
|
float |
getFloat(int offset)
Fetches a float from the given memory offset.
|
int |
getInt(int offset)
Fetches an integer from the given memory offset.
|
long |
getLong(int offset)
Fetches a long from the given memory offset.
|
short |
getShort(int offset)
Fetches a short from the given memory offset.
|
void |
putByte(int offset,
byte b)
Stores a byte at the given memory offset.
|
void |
putChar(int offset,
char c)
Stores a character at the given memory offset.
|
void |
putDouble(int offset,
double d)
Stores a double at the given memory offset.
|
void |
putFloat(int offset,
float f)
Stores a float at the given memory offset.
|
void |
putInt(int offset,
int i)
Stores an integer at the given memory offset.
|
void |
putLong(int offset,
long l)
Stores a long at the given memory offset.
|
void |
putShort(int offset,
short s)
Stores a short at the given memory offset.
|
int |
size()
Returns the memory count.
|
sun.misc.Unsafe |
unsafe()
Returns the underlying
Unsafe instance. |
public static NativeMemory allocate(int size)
DirectMemoryAllocator.size - The count of the memory to allocate.public MemoryAllocator<NativeMemory> allocator()
Memorypublic final long address()
Memorypublic final long address(int offset)
Memorypublic int size()
Memorypublic final sun.misc.Unsafe unsafe()
Unsafe instance.public NativeMemory copy()
Memorypublic byte getByte(int offset)
Memorypublic char getChar(int offset)
Memorypublic short getShort(int offset)
Memorypublic int getInt(int offset)
Memorypublic long getLong(int offset)
Memorypublic float getFloat(int offset)
Memorypublic double getDouble(int offset)
Memorypublic void putByte(int offset,
byte b)
Memorypublic void putChar(int offset,
char c)
Memorypublic void putShort(int offset,
short s)
Memorypublic void putInt(int offset,
int i)
Memorypublic void putLong(int offset,
long l)
Memorypublic void putFloat(int offset,
float f)
Memorypublic void putDouble(int offset,
double d)
Memorypublic void clear()
MemoryCopyright © 2013–2017. All rights reserved.