org.apache.sysds.runtime.controlprogram.caching

## Class ByteBuffer

- java.lang.Object
- - org.apache.sysds.runtime.controlprogram.caching.ByteBuffer

-     public class ByteBuffer
      extends Object

  Wrapper for WriteBuffer byte array per matrix/frame in order to support matrix/frame serialization outside global lock.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteBuffer(long size)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkSerialized()`
    `CacheBlock` | `deserializeBlock()`
    `void` | `evictBuffer(String fname)`
    `void` | `freeMemory()`
    `long` | `getSize()` Returns the buffer size in bytes.
    `boolean` | `isShallow()`
    `static boolean` | `isValidCapacity(long size, CacheBlock cb)` Determines if byte buffer can hold the given size given this specific cache block.
    `void` | `serializeBlock(CacheBlock cb)`

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

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

- - ### Constructor Detail

    - #### ByteBuffer

          public ByteBuffer(long size)

  - ### Method Detail

    - #### serializeBlock

          public void serializeBlock(CacheBlock cb)
                              throws IOException

      Throws:
        `IOException`

    - #### deserializeBlock

          public CacheBlock deserializeBlock()
                                      throws IOException

      Throws:
        `IOException`

    - #### evictBuffer

          public void evictBuffer(String fname)
                           throws IOException

      Throws:
        `IOException`

    - #### getSize

          public long getSize()

      Returns the buffer size in bytes.
      Returns:
        buffer size in bytes

    - #### isShallow

          public boolean isShallow()

    - #### freeMemory

          public void freeMemory()

    - #### checkSerialized

          public void checkSerialized()

    - #### isValidCapacity

          public static boolean isValidCapacity(long size,
                                                CacheBlock cb)

      Determines if byte buffer can hold the given size given this specific cache block. This call is consistent with 'serializeBlock' and allows for internal optimization according to dense/sparse representation.
      Parameters:
        `size` - the size
        `cb` - cache block
      Returns:
        true if valid capacity

Copyright © 2021 The Apache Software Foundation. All rights reserved.