org.apache.cassandra.io.util
Class Memory
java.lang.Object
org.apache.cassandra.io.util.Memory
- Direct Known Subclasses:
- RefCountedMemory
public class Memory
- extends java.lang.Object
An off-heap region of memory that must be manually free'd when no longer needed.
Field Summary |
protected long |
peer
|
Constructor Summary |
protected |
Memory(long bytes)
|
Method Summary |
static Memory |
allocate(long bytes)
|
boolean |
equals(java.lang.Object o)
|
void |
free()
|
byte |
getByte(long offset)
|
void |
getBytes(long memoryOffset,
byte[] buffer,
int bufferOffset,
int count)
Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset |
long |
getLong(long offset)
|
void |
setByte(long offset,
byte b)
|
void |
setBytes(long memoryOffset,
byte[] buffer,
int bufferOffset,
int count)
Transfers count bytes from buffer to Memory |
void |
setLong(long offset,
long l)
|
void |
setMemory(long offset,
long bytes,
byte b)
|
long |
size()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
peer
protected long peer
Memory
protected Memory(long bytes)
allocate
public static Memory allocate(long bytes)
setByte
public void setByte(long offset,
byte b)
setMemory
public void setMemory(long offset,
long bytes,
byte b)
setLong
public void setLong(long offset,
long l)
setBytes
public void setBytes(long memoryOffset,
byte[] buffer,
int bufferOffset,
int count)
- Transfers count bytes from buffer to Memory
- Parameters:
memoryOffset
- start offset in the memorybuffer
- the data bufferbufferOffset
- start offset of the buffercount
- number of bytes to transfer
getByte
public byte getByte(long offset)
getLong
public long getLong(long offset)
getBytes
public void getBytes(long memoryOffset,
byte[] buffer,
int bufferOffset,
int count)
- Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset
- Parameters:
memoryOffset
- start offset in the memorybuffer
- the data bufferbufferOffset
- start offset of the buffercount
- number of bytes to transfer
free
public void free()
size
public long size()
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
Copyright © 2013 The Apache Software Foundation