org.apache.cassandra.io.util
Class Memory

java.lang.Object
  extended by 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
 

Field Detail

peer

protected long peer
Constructor Detail

Memory

protected Memory(long bytes)
Method Detail

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 memory
buffer - the data buffer
bufferOffset - start offset of the buffer
count - 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 memory
buffer - the data buffer
bufferOffset - start offset of the buffer
count - 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