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