Enum Class DataBuffer.AccessMode
- All Implemented Interfaces:
Serializable
,Comparable<DataBuffer.AccessMode>
,Constable
- Enclosing interface:
DataBuffer
data buffers
.
There are 3 possible modes: READ
, READ_WRITE
and PRIVATE
.
See comments to these constants.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThis mode works almost alikeREAD_WRITE
, but any changes in the data array are lost.This access mode should be used if you need read-only access to the data.This access mode should be used if you need write access to data. -
Method Summary
Modifier and TypeMethodDescriptionstatic DataBuffer.AccessMode
Returns the enum constant of this class with the specified name.static DataBuffer.AccessMode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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 implementUpdatableArray
interface (so, it is probablyimmutable
ortrusted 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()
andDataBuffer.force(long, long)
methods throw an exception. -
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 implementUpdatableArray
interface (in particular, withimmutable
ortrusted immutable
arrays). -
PRIVATE
This mode works almost alikeREAD_WRITE
, but any changes in the data array are lost. More precisely, there are two differences fromREAD_WRITE
mode:- any changes the
data array
never reflect in the original storage (so, the data buffers, created with this mode, are never direct); DataBuffer.force()
andDataBuffer.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 thedata 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). - any changes the
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-