Memory (apache-cassandra API)
Date: 2014-10-21

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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `peer`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Memory(long bytes)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Memory` | `allocate(long bytes)`
    `java.nio.ByteBuffer[]` | `asByteBuffers()`
    `Memory` | `copy(long newSize)`
    `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
    `int` | `getInt(long offset)`
    `long` | `getLong(long offset)`
    `void` | `put(long trgOffset, Memory memory, long srcOffset, long size)`
    `void` | `setByte(long offset, byte b)`
    `void` | `setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count)` Transfers count bytes from buffer to Memory
    `void` | `setBytes(long memoryOffset, java.nio.ByteBuffer buffer)`
    `void` | `setInt(long offset, int l)`
    `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)

    - #### setInt

          public void setInt(long offset,
                    int l)

    - #### setBytes

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

    - #### 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)

    - #### getInt

          public int getInt(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

    - #### put

          public void put(long trgOffset,
                 Memory memory,
                 long srcOffset,
                 long size)

    - #### copy

          public Memory copy(long newSize)

    - #### free

          public void free()

    - #### size

          public long size()

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### asByteBuffers

          public java.nio.ByteBuffer[] asByteBuffers()

Copyright © 2014 The Apache Software Foundation