Package com.illumon.iris.db.util.file
Enum DataBufferCalculator
- All Implemented Interfaces:
Serializable
,Comparable<DataBufferCalculator>
,java.lang.constant.Constable
public enum DataBufferCalculator extends Enum<DataBufferCalculator>
Useful constants and utilities for manipulating buffers.
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description DEFAULT
The default instance used to calculate offsets for storing and communicating Deephaven-format binary data.WRITE_ONLY
The instance used to calculate offsets for write-only data append. -
Method Summary
Modifier and Type Method Description int
calculateBufferUsedSize(long totalUsedSize, int bufferIndex)
Calculate the used size of the specified buffer.int
getBufferIndex(long byteIndex)
Calculate the index of the column buffer that holds the desired element.int
getBufferSize()
static int
getDataRecordSizeInBytes(com.illumon.dataobjects.ColumnDefinition<?> columnDefinition)
static int
getDataRecordSizeToByteSizeShift(int recordSizeInBytes)
static int
getDataRecordSizeToByteSizeShift(com.illumon.dataobjects.ColumnDefinition<?> columnDefinition)
long
getFirstByteIndex(int bufferIndex)
Calculate the byte index of the first byte of the specified buffer.static int
getSimpleDataRecordSizeInBytes(Class<?> type)
int
getSubBufferByteIndex(long byteIndex)
Calculate the byte offset into the buffer that holds the specified byte index.static DataBufferCalculator
valueOf(String name)
Returns the enum constant of this type with the specified name.static DataBufferCalculator[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
DEFAULT
The default instance used to calculate offsets for storing and communicating Deephaven-format binary data. -
WRITE_ONLY
The instance used to calculate offsets for write-only data append.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getSimpleDataRecordSizeInBytes
-
getDataRecordSizeInBytes
public static int getDataRecordSizeInBytes(@NotNull com.illumon.dataobjects.ColumnDefinition<?> columnDefinition) -
getDataRecordSizeToByteSizeShift
public static int getDataRecordSizeToByteSizeShift(int recordSizeInBytes) -
getDataRecordSizeToByteSizeShift
public static int getDataRecordSizeToByteSizeShift(@NotNull com.illumon.dataobjects.ColumnDefinition<?> columnDefinition) -
getBufferSize
public final int getBufferSize() -
getBufferIndex
public final int getBufferIndex(long byteIndex)Calculate the index of the column buffer that holds the desired element.- Parameters:
byteIndex
- A byte index into a buffer series- Returns:
- The index of the column buffer that holds the desired element
-
getSubBufferByteIndex
public final int getSubBufferByteIndex(long byteIndex)Calculate the byte offset into the buffer that holds the specified byte index.- Parameters:
byteIndex
- A byte index into a buffer series- Returns:
- The byte offset into the buffer that holds the specified byte index
-
getFirstByteIndex
public final long getFirstByteIndex(int bufferIndex)Calculate the byte index of the first byte of the specified buffer.- Parameters:
bufferIndex
- The buffer's index in a buffer series- Returns:
- The byte index of the first byte of the specified buffer
-
calculateBufferUsedSize
public final int calculateBufferUsedSize(long totalUsedSize, int bufferIndex)Calculate the used size of the specified buffer.- Parameters:
totalUsedSize
- Total used size in bytes of a buffer seriesbufferIndex
- The buffer's index in the buffer series- Returns:
- The used size of the specified buffer
-