org.apache.cassandra.utils.memory

## Class MemoryUtil

- java.lang.Object
- - org.apache.cassandra.utils.memory.MemoryUtil

    public abstract class MemoryUtil
    extends java.lang.Object

### Field Summary

Fields
`static boolean` `INVERTED_ORDER`

### Constructor Summary

Constructors
Constructor and Description
`MemoryUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static long` `allocate(long size)`
`static java.nio.ByteBuffer` `duplicateByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer)`
`static java.nio.ByteBuffer` `duplicateDirectByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer)`
`static void` `free(long peer)`
`static byte` `getByte(long address)`
`static java.nio.ByteBuffer` `getByteBuffer(long address, int length)`
`static void` `getBytes(long address, byte[] buffer, int bufferOffset, int count)` Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset
`static java.nio.ByteBuffer` `getHollowByteBuffer()`
`static java.nio.ByteBuffer` `getHollowDirectByteBuffer()`
`static int` `getInt(long address)`
`static int` `getIntByByte(long address)`
`static long` `getLong(long address)`
`static long` `getLongByByte(long address)`
`static int` `getShort(long address)`
`static int` `getShortByByte(long address)`
`static void` `putIntByByte(long address, int value)`
`static void` `putLongByByte(long address, long value)`
`static void` `setByte(long address, byte b)`
`static void` `setByteBuffer(java.nio.ByteBuffer instance, long address, int length)`
`static void` `setBytes(byte[] src, int offset, long trg, long count)`
`static void` `setBytes(long address, byte[] buffer, int bufferOffset, int count)` Transfers count bytes from buffer to Memory
`static void` `setBytes(long address, java.nio.ByteBuffer buffer)`
`static void` `setBytes(long src, long trg, long count)`
`static void` `setInt(long address, int l)`
`static void` `setLong(long address, long l)`
`static void` `setShort(long address, short s)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### INVERTED_ORDER

    public static final boolean INVERTED_ORDER

### Constructor Detail

#### MemoryUtil

    public MemoryUtil()

### Method Detail

#### allocate

    public static long allocate(long size)

#### free

    public static void free(long peer)

#### setByte

    public static void setByte(long address,
                               byte b)

#### setShort

    public static void setShort(long address,
                                short s)

#### setInt

    public static void setInt(long address,
                              int l)

#### setLong

    public static void setLong(long address,
                               long l)

#### getByte

    public static byte getByte(long address)

#### getShort

    public static int getShort(long address)

#### getInt

    public static int getInt(long address)

#### getLong

    public static long getLong(long address)

#### getByteBuffer

    public static java.nio.ByteBuffer getByteBuffer(long address,
                                                    int length)

#### getHollowDirectByteBuffer

    public static java.nio.ByteBuffer getHollowDirectByteBuffer()

#### getHollowByteBuffer

    public static java.nio.ByteBuffer getHollowByteBuffer()

#### setByteBuffer

    public static void setByteBuffer(java.nio.ByteBuffer instance,
                                     long address,
                                     int length)

#### duplicateDirectByteBuffer

    public static java.nio.ByteBuffer duplicateDirectByteBuffer(java.nio.ByteBuffer source,
                                                                java.nio.ByteBuffer hollowBuffer)

#### duplicateByteBuffer

    public static java.nio.ByteBuffer duplicateByteBuffer(java.nio.ByteBuffer source,
                                                          java.nio.ByteBuffer hollowBuffer)

#### getLongByByte

    public static long getLongByByte(long address)

#### getIntByByte

    public static int getIntByByte(long address)

#### getShortByByte

    public static int getShortByByte(long address)

#### putLongByByte

    public static void putLongByByte(long address,
                                     long value)

#### putIntByByte

    public static void putIntByByte(long address,
                                    int value)

#### setBytes

    public static void setBytes(long address,
                                java.nio.ByteBuffer buffer)

#### setBytes

    public static void setBytes(long address,
                                byte[] buffer,
                                int bufferOffset,
                                int count)

Transfers count bytes from buffer to Memory

Parameters:
  `address` - start offset in the memory
  `buffer` - the data buffer
  `bufferOffset` - start offset of the buffer
  `count` - number of bytes to transfer

#### setBytes

    public static void setBytes(long src,
                                long trg,
                                long count)

#### setBytes

    public static void setBytes(byte[] src,
                                int offset,
                                long trg,
                                long count)

#### getBytes

    public static void getBytes(long address,
                                byte[] buffer,
                                int bufferOffset,
                                int count)

Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset

Parameters:
  `address` - start offset in the memory
  `buffer` - the data buffer
  `bufferOffset` - start offset of the buffer
  `count` - number of bytes to transfer