Enum Class DataBuffer.AccessMode

java.lang.Object
java.lang.Enum<DataBuffer.AccessMode>
net.algart.arrays.DataBuffer.AccessMode
All Implemented Interfaces:
Serializable, Comparable<DataBuffer.AccessMode>, Constable
Enclosing interface:
DataBuffer

public static enum DataBuffer.AccessMode extends Enum<DataBuffer.AccessMode>
Access mode, describing access to data buffers. There are 3 possible modes: READ, READ_WRITE and PRIVATE. See comments to these constants.
See Also:
  • Enum Constant Details

    • READ

      public static final DataBuffer.AccessMode READ
      This access mode should be used if you need read-only access to the data. For AlgART arrays, it is the only allowed mode if the array does not implement UpdatableArray interface (so, it is probably immutable or trusted immutable).

      Please note: there are no guarantees that the data buffer, created with this access mode, will not allow to change the data in the underlying storage. For example, in direct data buffer all changes in the data array reflect in the original storage immediately even in this access mode.

      In this access mode, DataBuffer.force() and DataBuffer.force(long, long) methods throw an exception.

    • READ_WRITE

      public static final DataBuffer.AccessMode READ_WRITE
      This access mode should be used if you need write access to data. It is the most common access mode, but it cannot be used with AlgART arrays that do not implement UpdatableArray interface (in particular, with immutable or trusted immutable arrays).
    • PRIVATE

      public static final DataBuffer.AccessMode PRIVATE
      This mode works almost alike READ_WRITE, but any changes in the data array are lost. More precisely, there are two differences from READ_WRITE mode:
      1. any changes the data array never reflect in the original storage (so, the data buffers, created with this mode, are never direct);
      2. DataBuffer.force() and DataBuffer.force(long, long) methods do nothing.

      In other words, this mode (unlike READ) guarantees that the data in the underlying storage will not be changed, and any changes in the data array will be lost. This mode can be convenient if you do not really need writing access to the data, but want to have a right to safely change the content of the returned data array (for example, to use it as a work memory).

  • Method Details

    • values

      public static DataBuffer.AccessMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DataBuffer.AccessMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null